home *** CD-ROM | disk | FTP | other *** search
/ MacHome 2001 June / MacHome Magazine Demo Disc June 2001.iso / Stuff / Software / Network / Snak / Snak 4.5.4 PPC / Scripts / purepak.irc < prev    next >
Encoding:
Text File  |  2000-11-05  |  104.9 KB  |  3,409 lines  |  [TEXT/R*ch]

  1.  
  2. # Snak adaptation 1.1. Removed handlers that emit conflicting messages and usually made '-'
  3. # Snak adaptation 1.2. Removed unnecessary checks for the correctness of ischanop
  4. # Snak adaptation 1.3. Removed pp.snm and calls to it as Snak does integrated highlighting
  5. # Snak adaptation 1.4. Removed pp.formecho in priv msg and notice handlers as it conflicts with normal message formatting
  6. #                       Removed //who when joining channel and message formatting in /who handler
  7. #                       Removed handlers for mesages 432 and 433 as Snak already does this
  8. #                       Removed message in notify_signon, and made it let Snak continue processing
  9. #                       Change order of handler and exec because execs are handled directly - not handed to the OS
  10. #                       The wait -CMD %<process> returns immediately as true
  11. #                       Removed CTCP handlers for ping, version, finger as Snak already does this
  12. #                       Modified dcc.ucmd.offer so that it asks properly for one or more files
  13. #                       dcc.ucmd.offer uses a variation on /input which asks for files
  14. #                       Because Mac files can contain spaces, the resulting list is separated by tabs, so 
  15. #                       a new function "listitem" is used instead of "word"
  16. #                      Removed fileexist from pp-dcc.irc alias and made a built in function
  17. #                       "Press ENTER to continue" in doechos removed..Snak can scoll.
  18. #                       /dcc save <file> saves package file in the scripts directory
  19. #                       /dcc notice now only sends to the current channel, not all channels.
  20. # Snak adaptation 1.5  the fileserver (/pphelp dcc) now works. Most changes consists of using listitem instead of word
  21. # To automatically load this into a connection, add "/load purepak.irc" to the startup actions.
  22. #
  23. # ########################################################################## #
  24. #                      PurePak - The sequel to TextBox                       #
  25. #                          A -+ TEXT +- production                           #
  26. # ########################################################################## #
  27. # Author: Crypt Keeper [ckeeper@axiom.access.one.net] (CKeeper on IRC)
  28. # Version 2.07
  29. #
  30. # This script requires at least ircII2.2.9 (Unix) or a fully ircII compatible
  31. # client.  It has only been tested under Unix with ircII2.2.9 and ircII2.8.2.
  32. #
  33. # If you edit this file, you must edit it with a Unix text editor or use
  34. # utilities like dos2unix/unix2dos to convert it to DOS to edit and then
  35. # back to Unix.  If it is edited in a DOS text editor it will be corrupted.
  36. #
  37. # All stolen code is labelled.  If it isn't labelled as stolen code, then it
  38. # is mine.  If you take my code, please give me credit.
  39. #
  40. # PurePak version 2.07 IRC script
  41. # Copyright (C) 1995
  42. #
  43. # This program is free software; you can redistribute it and/or modify
  44. # it under the terms of the GNU General Public License as published by
  45. # the Free Software Foundation; either version 1, or (at your option)
  46. # any later version.
  47. #
  48. # This program is distributed in the hope that it will be useful,
  49. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  50. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  51. # GNU General Public License for more details.
  52. #
  53. # You should have received a copy of the GNU General Public License
  54. # along with this program; if not, write to the Free Software
  55. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  56. # ########################################################################## #
  57.  
  58. ^set novice off
  59. ^set exec_protection off
  60. ^set input_protection off
  61. @ PPVERS = [2.07]
  62.  
  63. # ----------------------------------------------------------------------------
  64. # Sets and key bindings
  65. # ----------------------------------------------------------------------------
  66.  
  67. # See if we're on an EPIC client
  68. EVAL ^if (match(*EPIC* $status_user)) {@ PP.EPIC = 1}
  69.  
  70. EVAL ^set input_prompt [PurePak] version $PPVERS loading...
  71.  
  72. ^set tab on
  73. ^set tab_max 6
  74. ^set send_ignore_msg off
  75. ^set clock_24hour off
  76. ^set clock on
  77. ^set status_away  (away)
  78. ^set user_information [PurePak]
  79. ^set status_user [Lag ??] [PurePak] *
  80. ^set status_query  [Query: %Q]
  81. ^set status_notify  [Activity: %F]
  82. ^set status_oper *
  83. ^set status_overwrite  (overtype)
  84. ^set status_window ^^^^^^^^
  85. ^set status_mode  (+%+)
  86. ^set status_mail  [Mail: %M]
  87. ^set status_server  via %S
  88. ^set channel_name_width 10
  89. ^set debug 0
  90. ^set help_window off
  91. ^set help_prompt on
  92. ^set hold_mode_max 0
  93. ^set input_aliases off
  94. ^set insert_mode on
  95. ^set lastlog 16384
  96. ^set lastlog_level all
  97. ^set scroll on
  98. ^set scroll_lines 1
  99. ^set shell_limit 0
  100. ^set status_hold_lines  (%B)
  101. ^set command_mode off
  102. ^set double_status_line off
  103. ^set suppress_server_motd off
  104. ^set show_end_of_msgs off
  105. ^set beep_when_away 0
  106. EVAL ^set client_information [PurePak] v$PPVERS by Crypt Keeper
  107. ^set status_hold  -- ENTER --
  108. ^set beep_max 2
  109. ^set warn_of_ignores on
  110. ^set verbose_ctcp off
  111. ^set indent on
  112. ^set auto_whowas off
  113. ^set full_status_line on
  114. ^set continued_line  
  115. ^set hide_private_channels off
  116. ^set show_away_once on
  117. ^set history 120
  118. ^set auto_unmark_away off
  119. ^set beep_on_msg NONE
  120. ^set show_channel_names on
  121. ^set show_numerics off
  122. ^set max_recursions 210
  123. ^set log off
  124. ^set logfile irc.log
  125. ^set input_protection off
  126. ^set dcc_block_size 1024
  127. ^set no_ctcp_flood on
  128. ^EVAL ^if ([$mail] == [0]) {^set mail 1}
  129. ^EVAL ^set load_path ~/purepak:./purepak:~:$load_path
  130. ^set hold_mode off
  131. ^set notify_on_termination off
  132. ^set show_who_hopcount off
  133. ^set flood_warning off
  134. ^set flood_rate 1
  135. ^set flood_after 4
  136. ^set flood_users 4
  137. ^EVAL ^set status_format %T %*%@%N%#%Q%S%H%B%A%C%+%I%O%F %W%>%U%M%X%Y%Z 
  138.  
  139. bind ^X meta2
  140. bind ^\ switch_channels
  141. bind ^Q quote_character
  142. bind ^I parse_command ^tk.getmsg 1 $tk.msglist
  143. bind ^R parse_command ^tk.getmsg -1 $tk.msglist
  144. bind ^X^X parse_command tk.delnick
  145. bind ^S toggle_stop_screen
  146. bind ^[ meta1
  147. bind meta1-[ meta2
  148. bind meta1-O meta2
  149. bind meta2-^@ scroll_end
  150. bind meta2-A backward_history
  151. bind meta2-B forward_history
  152. bind meta2-C forward_character
  153. bind meta2-D backward_character
  154. bind meta2-5 parse_command ^s_up
  155. bind meta2-6 parse_command ^s_dn
  156. bind meta2-1 parse_command ^s_end
  157. bind meta2-7 parse_command ^s_end
  158. bind ^X^A scroll_backward
  159. bind ^X^B scroll_forward
  160. bind ^B self_insert
  161. bind ^_ self_insert
  162. bind ^V self_insert
  163. bind ^A self_insert
  164. bind ^O self_insert
  165. bind ^W next_window
  166. bind ^Z stop_irc
  167. bind ^U erase_line
  168.  
  169. alias s_up {
  170.     ^bind ~ nothing
  171.     ^type ^U^X^A^U
  172.     ^timer 1 ^bind ~ self_insert
  173. }
  174. alias s_dn {
  175.     ^bind ~ nothing
  176.     ^type ^U^X^B^U
  177.     ^timer 1 ^bind ~ self_insert
  178. }
  179. alias s_end {
  180.     ^bind ~ nothing
  181.     ^type ^[[^@
  182.     ^timer 1 ^bind ~ self_insert
  183. }
  184.  
  185. # File that settings are saved to
  186. @ PP.SAVEFILE = [purepak.sav]
  187.  
  188. on ^dcc_raw * {}
  189.  
  190. # ----------------------------------------------------------------------------
  191. # Tab key message history (originally from the ircII tabkey script)
  192. # ----------------------------------------------------------------------------
  193.  
  194. alias tk.addmsg {
  195.     @ tk.matched = rmatch($0 $^\1-)
  196.     if (tk.matched)
  197.     {
  198.         @ tk.msglist = [$(0-${tk.matched-1}) $(${tk.matched+1}-)]
  199.     }
  200.     { @ tk.msglist = [$(0-${tk.msgmax-1})] }
  201.     @ tk.msgcnt = 0
  202.     ^assign -tk.matched
  203. }
  204. alias tk.getmsg {
  205.     @ tk.msgcnt = tk.msgcnt + [$0]
  206.     if ( #tk.msglist < tk.msgcnt ) {@ tk.msgcnt = 1}
  207.     if (tk.msgcnt <= 0) {@ tk.msgcnt =  #tk.msglist}
  208.     @ tk.junk = K ## [msg]
  209.     type ^U$tk.junk $^^{[$($tk.msgcnt)]} 
  210. }
  211. alias tk.delnick {
  212.     if (tk.msgcnt == 0)
  213.     {
  214.         echo *** Nickname: $word(0 $tk.msglist) removed.
  215.         @ tk.msglist = [$notword(1 $tk.msglist)]
  216.     }
  217.     {
  218.         echo *** Nickname: $word(${tk.msgcnt-1} $tk.msglist) removed.
  219.         @ tk.msglist = [$notword($tk.msgcnt $tk.msglist)]
  220.     }
  221.     type ^U
  222. }
  223. alias notword {
  224.     if ([$0]>0)
  225.     {
  226.         if (([$0]>1)&&([$0] < rmatch($~ $1-))) {@ nw.sep = [ ]} {@ nw.sep = []}
  227.         @ function_return = [$(1-${[$0]-1})] ## [$nw.sep] ## [$(${[$0]+1}-)]
  228.     } {@ function_return = [$1-]}
  229. }
  230. alias minnot {
  231.     @ noticecnt = 0
  232.     ^assign -lastnoter
  233.     ^assign -ntemp
  234. }
  235.  
  236. # ----------------------------------------------------------------------------
  237. # Miscellaneous functions and aliases, mostly internal
  238. # ----------------------------------------------------------------------------
  239.  
  240. # Lame aliases for buggy clients
  241. alias say {
  242.     quote PRIVMSG $C :$*
  243.     echo <${N}> $*
  244. }
  245. alias sendto {
  246.     if (ischannel($0)) {^if ([$0] == C) {/echo <${N}> $1-} {/echo -> $0 <${N}> $1-}} {/echo -> [$0] $1-}
  247.     ^quote PRIVMSG $0 :$1-
  248. }
  249.  
  250. # /me alias that echoes to the right window (some clients don't)
  251. #alias me {
  252. #    xecho -LEVEL CRAP -WINDOW $winnum() * $N $*
  253. #    quote PRIVMSG $C :ACTION $*
  254. #}
  255.  
  256. # Repeats $1 $0 times
  257. alias repeatcmd {
  258.     @ RCOUNT = 0
  259.     while (RCOUNT < [$0])
  260.     {
  261.         @ RCOUNT = RCOUNT + 1
  262.         $1-
  263.     }
  264.     ^assign -RCOUNT
  265. }
  266.  
  267. alias nickonly {@ FUNCTION_RETURN = left($index(! $0) $0)}
  268. alias safestr {@ FUNCTION_RETURN = strip(\;\$ $*)}
  269.  
  270. # Returns 1 if you have ops on $0, 0 if you don't.  We use an alias instead
  271. # of ischanop() since ischanop doesn't always return a correct result on
  272. # older clients, and if ischanop were to say that you are not opped when you
  273. # really are, your protection stuff wouldn't go off.
  274. alias gotops {
  275.     @ FUNCTION_RETURN = 0
  276.     if ([$0] == C) {^if (P == [@]) {@ FUNCTION_RETURN = 1}}
  277.     {^if (ischanop($N $0)) {@ FUNCTION_RETURN = 1}}
  278. }
  279.  
  280. # Returns a random letter/number string
  281. @ PP.RC = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789a]
  282. alias randcrap {
  283.     @ RC = 1
  284.     while (RC < [$0])
  285.     {
  286.         @ RC = RC + 1
  287.         @ RS = mid($rand(62) 1 $PP.RC)##RS
  288.     }
  289.     @ RS = mid($rand(25) 1 $PP.RC)##RS
  290.     @ FUNCTION_RETURN = RS
  291.     ^assign -RS
  292.     ^assign -RC
  293. }
  294.  
  295. # Returns true if a string contains letters
  296. alias isalpha {
  297.     if (rmatch($0 *a* *b* *c* *d* *e* *f* *g* *h* *i* *j* *k* *l* *m* *n* *o* *p* *q* *r* *s* *t* *u* *v* *w* *x* *y* *z*)) {@ FUNCTION_RETURN = 1}
  298.     {@ FUNCTION_RETURN = 0}
  299. }
  300.  
  301. # delword <word> <list> (output returned in NLIST)
  302. # recursive alias that deletes a word from a list
  303. alias delword {
  304.     if ([$1] != [$0]) {^assign NLIST $1 $NLIST}
  305.     if ([$2]) {^delword $0 $2-}
  306. }
  307.  
  308. # Check is user is friended/shitted
  309. # ispal/isshit <n!u@h> <#channel>
  310. alias ispal {
  311.     @ FUNCTION_RETURN = 0
  312.     foreach PP.FRIENDS XZ {
  313.         if (match($decode($XZ) $1))
  314.         {
  315.             if (rmatch($0 $PP.FRIENDS[$XZ])) {@ FUNCTION_RETURN = 1}
  316.         }
  317.     }
  318.     ^assign -XZ
  319. }
  320. alias isshit {
  321.     @ FUNCTION_RETURN = 0
  322.     foreach PP.ENEMIES XZ {
  323.         if (match($decode($XZ) $1))
  324.         {
  325.             if (rmatch($0 $PP.ENEMIES[$XZ])) {@ FUNCTION_RETURN = 1}
  326.         }
  327.     }
  328.     ^assign -XZ
  329. }
  330.  
  331. # The pager for long displays, such as in help.
  332. # We do it like this so it doesn't use the old $"-MORE-" method
  333. # which is outdated and causes problems on newer clients.
  334. alias pp.pauseset {
  335.     @ ECCTR = 0
  336.     ^alias echo {
  337.         @ EC[$ECCTR] = [$*]
  338.         @ ECCTR = ECCTR + 1
  339.     }
  340. }
  341. alias pp.pauseend {
  342.     ^alias -echo
  343.     @ ECTR = 0
  344.     ^pp.doechos
  345. }
  346. # Snak adaptation 1.4. Removed check for numlines and "Press ENTER.." input. Snak can scroll...
  347. alias pp.doechos {
  348.     @ LCTR = 0
  349. #    while ((ECTR < ECCTR)&&(LCTR < PP.SET.NUMLINES))
  350.     while (ECTR < ECCTR)
  351.     {
  352.         @ LCTR = LCTR + 1
  353.         echo $EC[$ECTR]
  354.         ^assign -EC[$ECTR]
  355.         @ ECTR = ECTR + 1
  356.     }
  357. #    if ((LCTR >= PP.SET.NUMLINES)&&(ECTR < ECCTR)) {^input "** Press ENTER to continue **" ^pp.doechos}
  358. #    {
  359.         ^assign -LCTR
  360.         ^assign -ECTR
  361.         ^assign -ECCTR
  362.         foreach EC AA {^assign -EC[$AA]}
  363. #    }
  364. }
  365.  
  366. # ----------------------------------------------------------------------------
  367. # Default settings if purepak.sav doesn't exist
  368. # ----------------------------------------------------------------------------
  369.  
  370. # Letters in main settings variable (PP.SET): (this variable is about full)
  371. #   I - Auto-ignore on msg/notice/ctcp floods
  372. #   F - Flood filtering
  373. #   A - Ascii art kicker
  374. #   N - Nick flood protection
  375. #   E - Use enemies list
  376. #   L - Use friends list
  377. #   O - Let everyone know when you are set away
  378. #   G - Log messages and important stuff while away
  379. #   W - Send notices and/or warnings to people
  380. #   J - Auto rejoin on kick
  381. #   M - Mass deop/kick protection
  382. #   K - Channel key flash protection
  383. #   B - Ban protection
  384. #   X - Ignore CTCP PING
  385. #   Y - Ignore CTCP VERSION
  386. #   Z - Ignore CTCP FINGER
  387. #   S - Automatic deop on server ops
  388. #   H - Write awaylog to a file (PP.SET.ALFILE)
  389. #   C - Clonebot mass-join protection
  390. #   Q - Beep on private messages
  391. #   P - Auto-unload help
  392. #   V - Desynched user notification
  393. @ PP.SET = [CGFENLOWJMKBZPV]
  394.  
  395. # Response to mass deop/kick (0 = deop, 1 = kick)
  396. @ PP.SET.MASSRESP = 0
  397. # Auto-ignoring - number of seconds to autoignore
  398. @ PP.SET.IGSECS = 30
  399. # Short kill notice displays
  400. @ PP.SET.SHORTKILLS = 1
  401. # Server notice settings
  402. @ PP.SET.NOTELEVELS = [KUFNMC]
  403. # Nick flood protection sensitivity
  404. @ PP.SET.NFSENS = 3
  405. # Length of the first word in a message for it to be a junkflood
  406. @ PP.SET.JFLEN = 200
  407. # Away log file
  408. @ PP.SET.ALFILE = [away.log]
  409. # Exec commands to do various things
  410. @ PP.SET.FINGERCMD = [finger]
  411. @ PP.SET.LSCMD = [ls -l]
  412. @ PP.SET.LSWCMD = [ls -xp]
  413. @ PP.SET.RMCMD = [rm -f]
  414. @ PP.SET.MAILCMD = [mail]
  415. @ PP.SET.UUECMD = [uuencode]
  416. @ PP.SET.CATCMD = [cat]
  417. @ PP.SET.PSCMD = [ps -uxw]
  418. @ PP.SET.KILLCMD = [kill -KILL]
  419. @ PP.SET.UNGZCMD = [gunzip -c]
  420. @ PP.SET.UNZCMD = [uncompress -c]
  421. @ PP.SET.MKNODCMD = [mknod]
  422. @ PP.SET.NSLOOKCMD = [host]
  423. # Counter variable for awaylog
  424. @ PP.AWAYLCTR = 0
  425. # Minutes of idle-time to be set auto-away (0 disables)
  426. @ PP.SET.AUTOAWAY = 0
  427. # Clonebot mass-join sensitivity (number that must join in a 4 second span
  428. @ PP.SET.CPSENS = 3
  429. # NSLOOKUP on join for IP addresses
  430. @ PP.SET.LOOKJOIN = 1
  431. # Counter for clonebot mass-join detector
  432. @ PP.CPCTR = 0
  433. # Number of lines of output before a pause on help, playback, etc.
  434. @ PP.SET.NUMLINES = 22
  435. # Scripts we should auto-load:
  436. # K = Kicks, X = DCC, B = Bots, S = Silly, W = War
  437. @ PP.SET.AUTOLOAD = [XBS]
  438. # This is set to 1 after the first motd is seen
  439. @ PP.SEENMOTD = 0
  440. # Msg/notice formats
  441. @ PP.SET.MRFORMAT = encode([N!U] M)
  442. @ PP.SET.NRFORMAT = encode(-N- M)
  443. @ PP.SET.MSFORMAT = encode(-> [N] M)
  444. @ PP.SET.NSFORMAT = encode(-> -N- M)
  445. # Channel protection
  446. @ PP.SET.CHANPROT = 1
  447. # Show people as they signoff in splits
  448. @ PP.SET.SHOWSPLITTERS = 0
  449. # Suppress startup messages
  450. @ PP.SET.NOSTARTUP = 0
  451. # Insert random ?'s into bans
  452. @ PP.SET.FUNKYBANS = 1
  453. # Beep on netsplits
  454. @ PP.SET.BSP = 1
  455. # Allow CTCP PAGE
  456. @ PP.SET.CTCPPAGE = 1
  457. # Print time every 10 minutes
  458. @ PP.SET.TP = 0
  459. # Nick to match public
  460. @ PP.SET.PMATCH = [.]
  461.  
  462. # Msg/notice format settings to look like other scripts
  463. @ PP.MR.DEFAULT = encode([N!U] M)
  464. @ PP.MS.DEFAULT = encode(-> [N] M)
  465. @ PP.NR.DEFAULT = encode(-N- M)
  466. @ PP.NS.DEFAULT = encode(-> -N- M)
  467. @ PP.MR.IRCII = encode(*N* M)
  468. @ PP.MS.IRCII = encode(-> *N* M)
  469. @ PP.NR.IRCII = encode(-N- M)
  470. @ PP.NS.IRCII = encode(-> -N- M)
  471. @ PP.MR.TEXTBOX = encode(*N* M)
  472. @ PP.MS.TEXTBOX = encode(-> *N* M)
  473. @ PP.NR.TEXTBOX = encode(-N- M)
  474. @ PP.NS.TEXTBOX = encode(-> -N- M)
  475. @ PP.MR.LICE = encode([N!U] M)
  476. @ PP.MS.LICE = encode([*N*] M)
  477. @ PP.NR.LICE = encode(-N!U- M)
  478. @ PP.NS.LICE = encode([-N-] M)
  479. @ PP.MR.PHOENIX = encode([N:U] M)
  480. @ PP.MS.PHOENIX = encode(<-[N]-> M)
  481. @ PP.NR.PHOENIX = encode(-N- M)
  482. @ PP.NS.PHOENIX = encode(-> -N- M)
  483.  
  484. # ----------------------------------------------------------------------------
  485. # /pp alias to set script options
  486. # ----------------------------------------------------------------------------
  487.  
  488. # Other script parts (the pp-*.irc scripts) can add to this array and have
  489. # their settings under /pp
  490. @ PP.SETCHECKS.M = [^pp.set.m]
  491.  
  492. alias pp.set.bstatus {^if ([$0]) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  493. alias pp.set.tstatus {^if (index($0 $PP.SET) >= 0) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  494. alias pp.set.changetoggle {
  495.     if ([$1])
  496.     {
  497.         if ([$1] == [OFF]) {@ PP.SET = strip($0 $PP.SET)}
  498.         {^if (index($0 $PP.SET) < 0) {@ PP.SET = [$0]##PP.SET}}
  499.     }
  500. }
  501. # Snak adaptation 1.4. Snak already handles this
  502. alias pp.set.setupctcp {
  503. #    if (index(X $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**PING**"} {^on ^raw_irc "% PRIVMSG % :**PING**" {}}
  504. #    if (index(Y $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**VER**"} {^on ^raw_irc "% PRIVMSG % :**VER**" {}}
  505. #    if (index(Z $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**FINGER**"} {^on ^raw_irc "% PRIVMSG % :**FINGER**" {}}
  506. }
  507. alias pp.set.onoff {^if ([$0]) {@ FUNCTION_RETURN = [ON]} {@ FUNCTION_RETURN = [OFF]}}
  508.  
  509. alias status {
  510.     ^pp.pauseset
  511.     echo -- Current PurePak settings:
  512.     echo -- ===========================================================================
  513.     echo -- Automatic flood ignoring (AIGnore)                      : $pp.set.tstatus(I)
  514.     echo -- Filtering of known floods (FFILTer)                     : $pp.set.tstatus(F)
  515.     echo -- ASCII art kicker (ARTKick)                              : $pp.set.tstatus(A)
  516.     echo -- Kicking on kick flood (NFProt)                          : $pp.set.tstatus(N)
  517.     echo -- Use of enemies list (ENEMies)                           : $pp.set.tstatus(E)
  518.     echo -- Use of friends list (FRIends)                           : $pp.set.tstatus(L)
  519.     echo -- Public announcement of away status (AWAYNotices)        : $pp.set.tstatus(O)
  520.     echo -- Logging of msgs/events while away (AWAYLogging)         : $pp.set.tstatus(G)
  521.     echo -- Logging to an away log file (AWAYWriting)               : $pp.set.tstatus(H)
  522.     echo -- Name of away log file (AFILE)                           : ${PP.SET.ALFILE}
  523.     echo -- General miscellaneous warnings/notices (NOTIces)        : $pp.set.tstatus(W)
  524.     echo -- Automatic rejoining on kick (KREJoin)                   : $pp.set.tstatus(J)
  525.     echo -- Mass deop/kick protection (MASSProt)                    : $pp.set.tstatus(M)
  526.     if (PP.SET.MASSRESP) {
  527.     echo -- Action taken on mass deop/kick (MASSAction)             : KICK
  528.     } {
  529.     echo -- Action taken on mass deop/kick (MASSAction)             : DEOP
  530.     }
  531.     echo -- Channel protection (CHANprot)                           : $pp.set.onoff($PP.SET.CHANPROT)
  532.     echo -- Automatic removal of server ops (SERVOP)                : $pp.set.tstatus(S)
  533.     echo -- Channel key flash protection (KEYProt)                  : $pp.set.tstatus(K)
  534.     echo -- Ban defense (BANDefense)                                : $pp.set.tstatus(B)
  535.     echo -- Ignoring of CTCP PINGs (PING)                           : $pp.set.tstatus(X)
  536.     echo -- Ignoring of CTCP FINGERs (FINGer)                       : $pp.set.tstatus(Z)
  537.     echo -- Ignoring of CTCP VERSIONs (VERsion)                     : $pp.set.tstatus(Y)
  538.     echo -- Seconds to auto-ignore flooders (IGTime)                : ${PP.SET.IGSECS}
  539.     echo -- Nick flood protection sensitivity (NFSens)              : ${PP.SET.NFSENS}
  540.     echo -- Length of first word for a msg to be junkflood (JFLEN)  : ${PP.SET.JFLEN}
  541.     echo -- Desynched user notification (DESynchnote)               : $pp.set.tstatus(V)
  542.     echo -- Beeping on private messages (MSGBeep)                   : $pp.set.tstatus(Q)
  543.     if (PP.SET.AUTOAWAY) {
  544.     echo -- Minutes of idle time before being set away (AUTOAway)   : ${PP.SET.AUTOAWAY}
  545.     } {
  546.     echo -- Minutes of idle time before being set away (AUTOAway)   : OFF
  547.     }
  548.     echo -- NS lookup of IP adresses on join                        : $pp.set.onoff($PP.SET.LOOKJOIN)
  549.     echo -- Clonebot mass-join protection (CLONEProt)               : $pp.set.tstatus(C)
  550.     echo -- Clonebot mass-join protection sensitivity (CLONESens)   : ${PP.SET.CPSENS}
  551.     if (suppress_server_motd == [ON])
  552.     {
  553.     echo -- Server motd display at startup (MOTD)                   : OFF
  554.     } {
  555.     echo -- Server motd display at startup (MOTD)                   : ON
  556.     }
  557.     echo -- Show users who join/signoff in splits (SHOWSPLITters)   : $pp.set.onoff($PP.SET.SHOWSPLITTERS)
  558.     echo -- Number of rows on this display (ROWS)                   : ${PP.SET.NUMLINES + 2}
  559.     echo -- Auto-loading of pp-bots.irc (LOADBots)                  : $pp.set.sload(B)
  560.     echo -- Auto-loading of pp-xdcc.irc (LOADXdcc)                  : $pp.set.sload(X)
  561.     echo -- Auto-loading of pp-silly.irc (LOADSilly)                : $pp.set.sload(S)
  562.     echo -- Auto-loading of pp-war.irc (LOADWar)                    : $pp.set.sload(W)
  563.     echo -- Auto-loading of pp-kicks.irc (LOADKicks)                : $pp.set.sload(K)
  564.     echo -- Suppression of script startup screens                   : $pp.set.onoff($PP.SET.NOSTARTUP)
  565.     echo -- Insert random ?'s into bans (FUNkybans)                 : $pp.set.onoff($PP.SET.FUNKYBANS)
  566.     echo -- Beep on netsplits (BEEPSPLIT)                           : $pp.set.onoff($PP.SET.BSP)
  567.     echo -- CTCP PAGE (PAGE)                                        : $pp.set.onoff($PP.SET.CTCPPAGE)
  568.     echo -- Print time every 10 minutes (TPRINT)                    : $pp.set.onoff($PP.SET.TP)
  569.     echo -- String to match and highlight in public (PMATCH)        : ${PP.SET.PMATCH}
  570.     echo -- ===========================================================================
  571.     ^pp.pauseend
  572. }
  573.  
  574. alias pp.set.sload {
  575.     if ([$1])
  576.     {
  577.         if ([$1] == [ON])
  578.         {
  579.             if (index($0 $PP.SET.AUTOLOAD) < 0) {@ PP.SET.AUTOLOAD = PP.SET.AUTOLOAD##[$0]}
  580.             pp.autoload
  581.         } {@ PP.SET.AUTOLOAD = strip($0 $PP.SET.AUTOLOAD)}
  582.     } {^if (index($0 $PP.SET.AUTOLOAD) >= 0) {@ FUNCTION_RETURN = [ON]} {@ FUNCTION_RETURN = [OFF]}}
  583. }
  584. alias pp.autoload {
  585.     if ((index(K $PP.SET.AUTOLOAD) >= 0)&&(!(PP.KICKS))) {/load pp-kicks.irc}
  586.     if ((index(B $PP.SET.AUTOLOAD) >= 0)&&(!(PP.BOTS))) {/load pp-bots.irc}
  587.     if ((index(S $PP.SET.AUTOLOAD) >= 0)&&(!(PP.SILLY))) {/load pp-silly.irc}
  588.     if ((index(X $PP.SET.AUTOLOAD) >= 0)&&(!(PP.DCC))) {/load pp-dcc.irc}
  589.     if ((index(W $PP.SET.AUTOLOAD) >= 0)&&(!(PP.WAR))) {/load pp-war.irc}
  590. }
  591.  
  592. alias pp.set.setmformat {
  593.     echo *** Special characters in msg/notice outgoing display formats:
  594.     echo ***   N = Nickname of person you are sending to
  595.     echo ***   M = Text of the message you are sending
  596.     echo ***   T = Current time
  597.     echo *** Special characters in msg/notice incoming display formats:
  598.     echo ***   N = Nickname of the person who sent the msg/notice
  599.     echo ***   U = User@host of sender
  600.     echo ***   M = Text of message
  601.     echo ***   T = Current time
  602.     echo *** ^V,^B,^O,^_ control characters can also be used
  603.     echo ***
  604.     echo *** You may enter new formats for any of these, or press enter for no
  605.     echo *** change.
  606.     echo ***
  607.     echo *** Current incoming message format is: $decode($PP.SET.MRFORMAT)
  608.     ^input "New incoming message format or enter for no change >>" if (1) {
  609.         if ([$0]) {@ PP.SET.MRFORMAT = encode($*)}
  610.         echo *** Current outgoing message format is: $decode($PP.SET.MSFORMAT)
  611.         ^input "New outgoing message format or enter for no change >>" if (1) {
  612.             if ([$0]) {@ PP.SET.MSFORMAT = encode($*)}
  613.             echo *** Current incoming notice format is: $decode($PP.SET.NRFORMAT)
  614.             ^input "New incoming notice format or enter for no chaange >>" if (1) {
  615.                 if ([$0]) {@ PP.SET.NRFORMAT = encode($*)}
  616.                 echo *** Current outgoing notice format is: $decode($PP.SET.NSFORMAT)
  617.                 ^input "New outgoing notice format or enter for no change >>" if (1) {
  618.                     if ([$0]) {@ PP.SET.NSFORMAT = encode($*)}
  619.                     echo ***
  620.                     echo *** Message formats are now set to:
  621.                     echo *** Incoming message: $decode($PP.SET.MRFORMAT)
  622.                     echo *** Outgoing message: $decode($PP.SET.MSFORMAT)
  623.                     echo *** Incoming notice: $decode($PP.SET.NRFORMAT)
  624.                     echo *** Outgoing notice: $decode($PP.SET.NSFORMAT)
  625.                     echo ***
  626.                     echo *** If you have made changes, you must save with /sve for your changes
  627.                     echo *** to become permanent.
  628.                 }
  629.             }
  630.         }
  631.     }
  632. }
  633.  
  634. # *** Main script settings:
  635. # AIGnore = Automatic flood ignoring
  636. # FFILTer = Filtering of known floods
  637. # ARTKick = ASCII art kicker
  638. # NFProt = Kicking on nick flood
  639. # ENEMies = Use of enemies list
  640. # FRIends = Use of friends list
  641. # AWAYNotices = Public announcement of away status
  642. # AWAYLogging = Logging of msgs/events while away
  643. # AWAYWriting = Logging to an away log file
  644. # AFILE = Name of away log file
  645. # NOTIces = General warnings/notices
  646. # KREJoin = Automatic rejoining on kick
  647. # MASSProt = Mass deop/kick protection
  648. # MASSAction = Action taken on mass deop/kick
  649. # SERVOP = Automatic removal of server ops
  650. # KEYProt = Channel key flash protection
  651. # BANDefense = Ban defense
  652. # PING = Ignoring of CTCP PING
  653. # FINGer = Ignoring of CTCP FINGER
  654. # VERsion = Ignoring of CTCP VERSION
  655. # IGTime = Seconds to auto-ignore flooders
  656. # NFSens = Sensitivity of nick flood protection (higher values more sensitive)
  657. # JFLEN = First word length for a message to be a junkflood
  658. # *CMD = Correspond with PP.SET.*CMD above
  659. # MSGBeep = Beep on private messages
  660. # AUTOAway = Minutes of idle-time to be automaticly set away
  661. # CLONEProt = Clonebot mass-join protection
  662. # CLONESens = Sensitivity of clonebot mass-join protection (lower values more sensitive)
  663. # ROWS = Number of rows on display
  664. # LOADBots = Auto load pp-bots.irc
  665. # LOADWar = Auto load pp-war.irc
  666. # LOADSilly = Auto load pp-silly.irc
  667. # LOADKicks = Auto load pp-kicks.irc
  668. # LOADDcc = Auto load pp-dcc.irc
  669. # HELPUnload = Auto unloading of help
  670. # DESynchnote = Desynched user notification
  671. # WRITEMETHOD = /sve write method
  672. # MOTD = Server motd display at startup
  673. # MFORMAT = Msg/notice format settings
  674. # CHANprot = Channel protection
  675. # SHOWSPLITters = Show users who join/signoff in splits
  676. # LOOKJoin = NS lookup of IP adresses on join
  677. # NOSTARTUP = Suppression of startup screens
  678. # FUNkybans = Insert random ?'s into bans
  679. # BEEPSPLIT = Beep on netsplits
  680. # PAGE = CTCP PAGE
  681. # TPRINT = Print time every 10 minutes
  682. # PMATCH = String to match and highlight publicly
  683. alias pp.set.m {
  684.     if (rmatch($0 LOADK* LOADB* LOADW* LOADS* LOADD*))
  685.     {
  686.         if (match($1 ON OFF))
  687.         {
  688.             if (match(LOADB* $0)) {/pp.set.sload B $1}
  689.             if (match(LOADW* $0)) {/pp.set.sload W $1}
  690.             if (match(LOADS* $0)) {/pp.set.sload S $1}
  691.             if (match(LOADK* $0)) {/pp.set.sload K $1}
  692.             if (match(LOADD* $0)) {/pp.set.sload X $1}
  693.         }
  694.         if (match(LOADB* $0)) {/echo *** Auto-loading of pp-bots.irc is now $pp.set.sload(B)}
  695.         if (match(LOADW* $0)) {/echo *** Auto-loading of pp-war.irc is now $pp.set.sload(W)}
  696.         if (match(LOADS* $0)) {/echo *** Auto-loading of pp-silly.irc is now $pp.set.sload(S)}
  697.         if (match(LOADK* $0)) {/echo *** Auto-loading of pp-kicks.irc is now $pp.set.sload(K)}
  698.         if (match(LOADD* $0)) {/echo *** Auto-loading of pp-dcc.irc is now $pp.set.sload(X)}
  699.         @ VU = 1
  700.     }
  701.     if ([$0] == [PAGE])
  702.     {
  703.         if (match($1 ON OFF))
  704.         {
  705.             if ([$1] == [ON]) {@ PP.SET.CTCPPAGE = 1} {@ PP.SET.CTCPPAGE = 0}
  706.         }
  707.         echo *** CTCP PAGE response is now $pp.set.onoff($PP.SET.CTCPPAGE)
  708.         @ VU = 1
  709.     }
  710.     if ([$0] == [TPRINT])
  711.     {
  712.         if (match($1 ON OFF))
  713.         {
  714.             if ([$1] == [ON]) {@ PP.SET.TP = 1} {@ PP.SET.TP = 0}
  715.         }
  716.         echo *** Print time every 10 minutes is now $pp.set.onoff($PP.SET.TP)
  717.         @ VU = 1
  718.     }
  719.     if ([$0] == [BEEPSPLIT])
  720.     {
  721.         if (match($1 ON OFF))
  722.         {
  723.             if ([$1] == [ON]) {@ PP.SET.BSP = 1} {@ PP.SET.BSP = 0}
  724.         }
  725.         echo *** Beep on netsplits is now $pp.set.onoff($PP.SET.BSP)
  726.         @ VU = 1
  727.     }
  728.     if (match(LOOKJ* $0))
  729.     {
  730.         if (match($1 ON OFF))
  731.         {
  732.             if ([$1] == [ON]) {@ PP.SET.LOOKJOIN = 1} {@ PP.SET.LOOKJOIN = 0}
  733.         }
  734.         echo *** NS lookup of IP adresses on join is now $pp.set.onoff($PP.SET.LOOKJOIN)
  735.         @ VU = 1
  736.     }
  737.     if ([$0] == [NOSTARTUP])
  738.     {
  739.         if (match($1 ON OFF))
  740.         {
  741.             if ([$1] == [ON]) {@ PP.SET.NOSTARTUP = 1} {@ PP.SET.NOSTARTUP = 0}
  742.         }
  743.         echo *** Suppression of script startup screens is now $pp.set.onoff($PP.SET.NOSTARTUP)
  744.         @ VU = 1
  745.     }
  746.     if (match(FUN* $0))
  747.     {
  748.         if (match($1 ON OFF))
  749.         {
  750.             if ([$1] == [ON]) {@ PP.SET.FUNKYBANS = 1} {@ PP.SET.FUNKYBANS = 0}
  751.         }
  752.         echo *** Insert random ?'s into bans is now $pp.set.onoff($PP.SET.FUNKYBANS)
  753.         @ VU = 1
  754.     }
  755.     if (match(SHOWSPLIT* $0))
  756.     {
  757.         if (match($1 ON OFF))
  758.         {
  759.             if ([$1] == [ON]) {@ PP.SET.SHOWSPLITTERS = 1} {@ PP.SET.SHOWSPLITTERS = 0}
  760.         }
  761.         echo *** Showing of users who join/signoff in netsplits is now $pp.set.onoff($PP.SET.SHOWSPLITTERS)
  762.         @ VU = 1
  763.     }
  764.     if ([$0] == [MFORMAT])
  765.     {
  766.         @ VU = 1
  767.         if ([$1])
  768.         {
  769.             if (match($1 IRCII TEXTBOX PHOENIX LICE DEFAULT))
  770.             {
  771.                 @ PP.SET.MRFORMAT = PP.MR[$1]
  772.                 @ PP.SET.NRFORMAT = PP.NR[$1]
  773.                 @ PP.SET.MSFORMAT = PP.MS[$1]
  774.                 @ PP.SET.NSFORMAT = PP.NS[$1]
  775.                 echo *** Your msgs/notices now look like: $toupper($1)
  776.             } {/echo *** /pp mformat [<ircii/textbox/phoenix/lice>]}
  777.         } {^pp.set.setmformat}
  778.     }
  779.     if (match(CHAN* $0))
  780.     {
  781.         if (match($1 ON OFF))
  782.         {
  783.             if ([$1] == [ON]) {@ PP.SET.CHANPROT = 1} {@ PP.SET.CHANPROT = 0}
  784.         }
  785.         echo *** Channel protection is now $pp.set.onoff($PP.SET.CHANPROT)
  786.         @ VU = 1
  787.     }
  788.     if (match(DES* $0))
  789.     {
  790.         ^pp.set.changetoggle V $1
  791.         echo *** Desynched user notification is now $pp.set.tstatus(V)
  792.         @ VU = 1
  793.     }
  794.     if (match(AIG* $0))
  795.     {
  796.         ^pp.set.changetoggle I $1
  797.         echo *** Auto-ignoring on msg/notice/ctcp/nick floods is now $pp.set.tstatus(I)
  798.         @ VU = 1
  799.     }
  800.     if ([$0] == [MOTD])
  801.     {
  802.         if (match($1 ON OFF))
  803.         {
  804.             if ([$1] == [ON]) {^set suppress_server_motd OFF} {^set suppress_server_motd ON}
  805.         }
  806.         if (suppress_server_motd == [ON]) {/echo *** Server motd display at startup is now OFF}
  807.         {/echo *** Server motd display at startup is now ON}
  808.         @ VU = 1
  809.     }
  810.     if (match(FFILT* $0))
  811.     {
  812.         ^pp.set.changetoggle F $1
  813.         echo *** Filtering of known floods in msgs/notices/public messages is now $pp.set.tstatus(F)
  814.         @ VU = 1
  815.     }
  816.     if (match(ARTK* $0))
  817.     {
  818.         ^pp.set.changetoggle A $1
  819.         echo *** ASCII art kicker is now $pp.set.tstatus(A)
  820.         @ VU = 1
  821.     }
  822.     if (match(HELPU* $0))
  823.     {
  824.         ^pp.set.changetoggle P $1
  825.         echo *** Automatic unloading of help information is now $pp.set.tstatus(P)
  826.         @ VU = 1
  827.     }
  828.     if (match(NFP* $0))
  829.     {
  830.         ^pp.set.changetoggle N $1
  831.         echo *** Kicking on nick flood is now $pp.set.tstatus(N)
  832.         @ VU = 1
  833.     }
  834.     if (match(ENEM* $0))
  835.     {
  836.         ^pp.set.changetoggle E $1
  837.         echo *** Checking/use of enemies list is now $pp.set.tstatus(E)
  838.         @ VU = 1
  839.     }
  840.     if (match(FRI* $0))
  841.     {
  842.         ^pp.set.changetoggle L $1
  843.         echo *** Checking/use of friends list is now $pp.set.tstatus(L)
  844.         @ VU = 1
  845.     }
  846.     if (match(AWAYN* $0))
  847.     {
  848.         ^pp.set.changetoggle O $1
  849.         echo *** Public announcement of away status is now $pp.set.tstatus(O)
  850.         @ VU = 1
  851.     }
  852.     if (match(AWAYL* $0))
  853.     {
  854.         ^pp.set.changetoggle G $1
  855.         echo *** Logging of messages and important events while away is now $pp.set.tstatus(G)
  856.         @ VU = 1
  857.     }
  858.     if (match(NOTI* $0))
  859.     {
  860.         ^pp.set.changetoggle W $1
  861.         echo *** Sending of general warnings/notices is now $pp.set.tstatus(W)
  862.         @ VU = 1
  863.     }
  864.     if (match(KREJ* $0))
  865.     {
  866.         ^pp.set.changetoggle J $1
  867.         echo *** Automatic rejoining on kick is now $pp.set.tstatus(J)
  868.         @ VU = 1
  869.     }
  870.     if (match(MASSP* $0))
  871.     {
  872.         ^pp.set.changetoggle M $1
  873.         echo *** Mass deop/kick protection is now $pp.set.tstatus(M)
  874.         @ VU = 1
  875.     }
  876.     if (match(MASSA* $0))
  877.     {
  878.         if (match($1 KICK DEOP))
  879.         {
  880.             if ([$1] == [KICK]) {@ PP.SET.MASSRESP = 1} {@ PP.SET.MASSRESP = 0}
  881.         }
  882.         if (PP.SET.MASSRESP) {/echo *** Action taken on mass deop/kick is now KICK}
  883.         {/echo *** Action taken on mass deop/kick is now DEOP}
  884.         @ VU = 1
  885.     }
  886.     if (match(KEYP* $0))
  887.     {
  888.         ^pp.set.changetoggle K $1
  889.         echo *** Channel key flash protection is now $pp.set.tstatus(K)
  890.         @ VU = 1
  891.     }
  892.     if (([$0] == [SERVOP])||([$0] == [NHP]))
  893.     {
  894.         ^pp.set.changetoggle S $1
  895.         echo *** Automatic removal of server ops is now $pp.set.tstatus(S)
  896.         @ VU = 1
  897.     }
  898.     if (match(CLONEP* $0))
  899.     {
  900.         ^pp.set.changetoggle C $1
  901.         echo *** Clonebot mass-join protection is now $pp.set.tstatus(C)
  902.         @ VU = 1
  903.     }
  904.     if (match(BAND* $0))
  905.     {
  906.         ^pp.set.changetoggle B $1
  907.         echo *** Ban defense is now $pp.set.tstatus(B)
  908.         @ VU = 1
  909.     }
  910.     if ([$0] == [PING])
  911.     {
  912.         ^pp.set.changetoggle X $1
  913.         echo *** Ignoring of CTCP PINGs is now $pp.set.tstatus(X)
  914.         @ VU = 1
  915.         ^pp.set.setupctcp
  916.     }
  917.     if (match(FING* $0))
  918.     {
  919.         ^pp.set.changetoggle Z $1
  920.         echo *** Ignoring of CTCP FINGERs is now $pp.set.tstatus(Z)
  921.         @ VU = 1
  922.         ^pp.set.setupctcp
  923.     }
  924.     if (match(VER* $0))
  925.     {
  926.         ^pp.set.changetoggle Y $1
  927.         echo *** Ignoring of CTCP VERSIONs is now $pp.set.tstatus(Y)
  928.         @ VU = 1
  929.         ^pp.set.setupctcp
  930.     }
  931. # Snak adaptation 1.3 Snak has integrated highlighting
  932. #    if ([$0] == [PMATCH])
  933. #    {
  934. #        if ([$1])
  935. #        {
  936. #            if ((PP.SET.PMATCH == [.])&&([$1] != [.])) {^pp.snm $strip(_-[] $N) $1}
  937. #            if ((PP.SET.PMATCH != [.])&&([$1] == [.])) {^pp.snm $PP.SET.PMATCH $strip(_-[] $N)}
  938. #            @ PP.SET.PMATCH = [$1]
  939. #        }
  940. #        echo *** String to match and highlight in public now set to ${PP.SET.PMATCH}
  941. #        @ VU = 1
  942. #    }
  943.     if (match(IGT* $0))
  944.     {
  945.         if ([$1]) {
  946.             if (!isalpha($1)) {@ PP.SET.IGSECS = [$1]}
  947.             {/echo *** Must be a number (recommended value: 10-60)}
  948.         }
  949.         echo *** Number of seconds to auto-ignore flooders is now: ${PP.SET.IGSECS}
  950.         @ VU = 1
  951.     }
  952.     if (match(NFS* $0))
  953.     {
  954.         if ([$1]) {
  955.             if (!isalpha($1)) {@ PP.SET.NFSENS = [$1]}
  956.             {/echo *** Must be a number (recommended value: 3)}
  957.         }
  958.         echo *** Nick flood protection sensitivity is now: ${PP.SET.NFSENS}
  959.         if (PP.SET.NFSENS > 3) {/echo *** Warning: a setting of ${PP.SET.NFSENS} is very sensitive! (higher values more sensitive)}
  960.         @ VU = 1
  961.     }
  962.     if ([$0] == [ROWS])
  963.     {
  964.         if ([$1]) {
  965.             if (!isalpha($1)) {@ PP.SET.NUMLINES = [$1] - 2}
  966.             {/echo *** Must be a number}
  967.         }
  968.         echo *** Number of rows on this display is now: ${PP.SET.NUMLINES + 2}
  969.         @ VU = 1
  970.     }
  971.     if (match(CLONES* $0))
  972.     {
  973.         if ([$1]) {
  974.             if (!isalpha($1)) {@ PP.SET.CPSENS = [$1]}
  975.             {/echo *** Must be a number (recommended value: 3-5)}
  976.         }
  977.         echo *** Clonebot mass-join protection sensitivity is now: ${PP.SET.CPSENS}
  978.         if (PP.SET.CPSENS < 3) {/echo *** Warning: a setting of ${PP.SET.CPSENS} is very sensitive! (lower values more sensitive)}
  979.         @ VU = 1
  980.     }
  981.     if ([$0] == [JFLEN])
  982.     {
  983.         if ([$1]) {
  984.             if (!isalpha($1)) {@ PP.SET.JFLEN = [$1]}
  985.             {/echo *** Must be a number (recommended value: 200)}
  986.         }
  987.         echo *** First word length for a message to be a junkflood is now: ${PP.SET.JFLEN}
  988.         @ VU = 1
  989.     }
  990.     if (match(AUTOA* $0))
  991.     {
  992.         if ([$1]) {
  993.             if (!isalpha($1)) {@ PP.SET.AUTOAWAY = [$1]}
  994.             {
  995.                 if ([$1] == [OFF]) {@ PP.SET.AUTOAWAY = 0} {/echo *** Must be a number or 'off' to turn off.}
  996.             }
  997.         }
  998.         echo *** Minutes of idle-time before being set away (0=auto-away disabled): ${PP.SET.AUTOAWAY}
  999.         @ VU = 1
  1000.     }
  1001.     if (match(*CMD $0))
  1002.     {
  1003.         foreach PP.SET AA {
  1004.             if ([$AA] == [$0])
  1005.             {
  1006.                 if ([$1]) {@ PP.SET[$AA] = [$1-]}
  1007.                 echo *** $AA is now [${PP.SET[$AA]}]
  1008.                 @ VU = 1
  1009.             }
  1010.         }
  1011.     }
  1012.     if (match(MSGB* $0))
  1013.     {
  1014.         if (match($1 ON OFF))
  1015.         {
  1016.             ^pp.set.changetoggle Q $1
  1017.             if ([$1] == [ON]) {^set beep_on_msg MSG}
  1018.             {^set beep_on_msg NONE}
  1019.         }
  1020.         echo *** Beeping on private messages is now $pp.set.tstatus(Q)
  1021.         @ VU = 1
  1022.     }
  1023.     if (match(LOGF* $0))
  1024.     {
  1025.         if ([$1]) {^set logfile $1}
  1026.         echo *** IRC logging is now sent to file ${LOGFILE}
  1027.         @ VU = 1
  1028.     }
  1029.     if ([$0] == [LOG])
  1030.     {
  1031.         if (match($1 ON OFF)) {^if ([$1] == [ON]) {^set log on} {^set log off}}
  1032.         echo *** Logging to $LOGFILE is now ${LOG}
  1033.         @ VU = 1
  1034.     }
  1035.     if (match(AWAYW* $0))
  1036.     {
  1037.         ^pp.set.changetoggle H $1
  1038.         echo *** Away log writing to $PP.SET.ALFILE is now $pp.set.tstatus(H)
  1039.         @ VU = 1
  1040.     }
  1041.     if ([$0] == [AFILE])
  1042.     {
  1043.         if ([$1]) {@ PP.SET.ALFILE = [$1]}
  1044.         echo *** Away log file is now ${PP.SET.ALFILE}
  1045.         @ VU = 1
  1046.     }
  1047. }
  1048.  
  1049. alias pp {
  1050.     if ([$0])
  1051.     {
  1052.         @ VU = 0
  1053.         foreach PP.SETCHECKS AA {^if (!VU) {$PP.SETCHECKS[$AA] $*}}
  1054.         if (!VU) {/echo *** No such variable: $0}
  1055.         ^assign -VU
  1056.     } {/echo *** /pp <variable> [<new setting>] (If new setting is left out, current setting is shown)}
  1057. }
  1058.  
  1059. # ----------------------------------------------------------------------------
  1060. # Command abbreviations
  1061. # ----------------------------------------------------------------------------
  1062.  
  1063. alias w {/who $*}
  1064. alias m {/msg $*}
  1065. alias t {/topic $*}
  1066. alias c {/mode $*}
  1067. alias l {
  1068.     leave $0
  1069.     if ([$1]) {/l $1-}
  1070. }
  1071. alias j {
  1072.     if (ischannel($1)) {/join $0} {/join $0 $1}
  1073.     if (ischannel($1)) {/j $1-}
  1074.     if (ischannel($2)) {/j $2-}
  1075. }
  1076. alias , {/whois $*}
  1077. alias wi {/whois $*}
  1078. alias ww {/whowas $*}
  1079. alias n {/nick $*}
  1080. alias k {/kick $*}
  1081. alias o {/op $*}
  1082. alias d {/deop $*}
  1083.  
  1084. alias scan {/names $*}
  1085.  
  1086. # ----------------------------------------------------------------------------
  1087. # Basic channel op command aliases
  1088. # ----------------------------------------------------------------------------
  1089.  
  1090. # Here's all the recursive list processing aliases for the mass commands
  1091. # pp.listm.<# at once> <mode> <#channel> <users>
  1092. alias pp.listm.1 {
  1093.     //mode $1 $0 $2
  1094.     if ([$3]) {^pp.listm.1 $0 $1 $3-}
  1095. }
  1096. alias pp.listm.2 {
  1097.     //mode $1 $0 $2 $3
  1098.     if ([$4]) {^pp.listm.2 $0 $1 $4-}
  1099. }
  1100. alias pp.listm.3 {
  1101.     //mode $1 $0 $2 $3 $4
  1102.     if ([$5]) {^pp.listm.3 $0 $1 $5-}
  1103. }
  1104. alias pp.listm.4 {
  1105.     //mode $1 $0 $2 $3 $4 $5
  1106.     if ([$6]) {^pp.listm.4 $0 $1 $6-}
  1107. }
  1108. # pp.listk <#channel> <nicks> ($KREASON contains reason for kicks)
  1109. alias pp.listk {
  1110.     //kick $0 $1 $KREASON
  1111.     if ([$2]) {^pp.listk $0 $2-}
  1112. }
  1113. # pp.listdcc <file> <nicks>
  1114. alias pp.listdcc {
  1115.     //^dcc send $1 $0
  1116.     if ([$2]) {^pp.listdcc $0 $2-}
  1117. }
  1118. # pp.listmsg <PRIVMSG/NOTICE> <nicks/channels> (SEND_MSG contains message)
  1119. alias pp.listmsg {
  1120.     ^quote $0 $1 :$SEND_MSG
  1121.     if ([$2]) {^pp.listmsg $0 $2-}
  1122. }
  1123. # pp.listunban <#channel> <strings>
  1124. alias pp.listunban {
  1125.     if ([$4])
  1126.     {
  1127.         //mode $0 -bbb $1 $2 $3
  1128.         ^pp.listunban $0 $4-
  1129.     } {^if ([$3]) {//mode $0 -bbb $1 $2 $3} {^if ([$2]) {//mode $0 -bb $1 $2} {^if ([$1]) {//mode $0 -b $1}}}}
  1130. }
  1131.  
  1132. # pp.mdop <#channel> <# at once> <mask>
  1133. # Smart massdeopper: deops the closest people net-wise first.  (Gee, I wonder
  1134. # how many scripts this is gonna appear in?)
  1135. alias pp.mdop {
  1136.     @ HIGHHOPS = 0
  1137.     @ DMASK = [$2]
  1138.     on ^who * {
  1139.         if ((match(*${DMASK}* $1!$3@$4))&&([$1] != N))
  1140.         {
  1141.             if (!match($1 $PP.BOTNICKS))
  1142.             {
  1143.                 if (!PP.EPIC)
  1144.                 {
  1145.                     @ MDOPZ[$5] = MDOPZ[$5]##[ $1]
  1146.                     if ([$5] > HIGHHOPS) {@ HIGHHOPS = [$5]}
  1147.                 }
  1148.                 {
  1149.                     @ MDOPZ[$6] = MDOPZ[$6]##[ $1]
  1150.                     if ([$6] > HIGHHOPS) {@ HIGHHOPS = [$6]}
  1151.                 }
  1152.             }
  1153.         }
  1154.     }
  1155.     //^who -chops $0
  1156.     @ DEOPCNT = [$1]
  1157.     @ DEOPCHAN = [$0]
  1158.     wait -CMD if (1) {
  1159.         if (DEOPCNT <= 1) {@ MCH = [-o]}
  1160.         if (DEOPCNT == 2) {@ MCH = [-oo]}
  1161.         if (DEOPCNT == 3) {@ MCH = [-ooo]}
  1162.         if (DEOPCNT >= 4) {@ MCH = [-oooo]}
  1163.         @ CTR = 0
  1164.         while (CTR <= HIGHHOPS)
  1165.         {
  1166.             @ MDOPZ = MDOPZ##[ $MDOPZ[$CTR]]
  1167.             ^assign -MDOPZ[$CTR]
  1168.             @ CTR = CTR + 1
  1169.         }
  1170.         ^pp.listm.$DEOPCNT $MCH $DEOPCHAN $MDOPZ
  1171.         ^assign -DEOPCNT
  1172.         ^assign -DEOPCHAN
  1173.         ^assign -MCH
  1174.         ^assign -HIGHHOPS
  1175.         ^assign -CTR
  1176.         ^assign -MDOPZ
  1177.         ^assign -DMASK
  1178.         ^on who -
  1179.     }
  1180. }
  1181.  
  1182. # pp.mkick <#channel> <mask> <reason>
  1183. alias pp.mkick {
  1184.     @ KMASK = [$1]
  1185.     ^on ^who * {
  1186.         ^if ((match(*${KMASK}* $1!$3@$4))&&([$1] != N))
  1187.         {
  1188.             ^if (!match($1 $PP.BOTNICKS)) {@ MKZ = [$1 $MKZ]}
  1189.         }
  1190.     }
  1191.     //^who $0
  1192.     @ KCHAN = [$0]
  1193.     @ KREASON = [$2-]
  1194.     wait -CMD if (1) {
  1195.         ^pp.listk $KCHAN $MKZ
  1196.         ^assign -KCHAN
  1197.         ^assign -MKZ
  1198.         ^assign -KMASK
  1199.         ^assign -KREASON
  1200.         ^on who -
  1201.     }
  1202. }
  1203.  
  1204. # pp.mop <#channel> <mask>
  1205. alias pp.mop {
  1206.     @ OPMASK = [$1]
  1207.     ^on ^who * {^if ((!match(*@* $2))&&(match(*${OPMASK}* $1!$3@$4))) {^if ([$1] != N) {@ MOPZ = [$MOPZ $1]}}}
  1208.     //^who $0
  1209.     @ MOPCHAN = [$0]
  1210.     wait -CMD if (1) {
  1211.         ^pp.listm.3 +ooo $MOPCHAN $MOPZ
  1212.         ^assign -MOPCHAN
  1213.         ^assign -MOPZ
  1214.         ^assign -OPMASK
  1215.         ^on ^who -
  1216.     }
  1217. }
  1218.  
  1219. # pp.modev <#channel> <mask> <+/->
  1220. alias pp.modev {
  1221.     @ VMASK = [$1]
  1222.     ^on ^who * {^if (match(*${VMASK}* $1!$3@$4)) {@ MVZ = [$MVZ $1]}}
  1223.     //^who $0
  1224.     @ MVCHAN = [$0]
  1225.     @ MVMODE = [$2]
  1226.     wait -CMD if (1) {
  1227.         ^pp.listm.3 ${MVMODE}vvv $MVCHAN $MVZ
  1228.         ^assign -MVCHAN
  1229.         ^assign -MVMODE
  1230.         ^assign -MVZ
  1231.         ^assign -VMASK
  1232.         ^on ^who -
  1233.     }
  1234. }
  1235.  
  1236. # The user mass commands
  1237. # mdop/mvop/mop/munvop [<mask>]
  1238. alias mdop.1 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 1 $0} {^pp.mdop $C 1 *}} {/echo *** You don't have ops on $C}}
  1239. alias mdop.2 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 2 $0} {^pp.mdop $C 2 *}} {/echo *** You don't have ops on $C}}
  1240. alias mdop.3 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 3 $0} {^pp.mdop $C 3 *}} {/echo *** You don't have ops on $C}}
  1241. alias mdop.4 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 4 $0} {^pp.mdop $C 4 *}} {/echo *** You don't have ops on $C}}
  1242. alias mdop {^mdop.4 $*}
  1243. alias mop {^if (gotops($C)) {^if ([$0]) {^pp.mop $C $0} {^pp.mop $C *}} {/echo *** You don't have ops on $C}}
  1244. alias mvop {^if (gotops($C)) {^if ([$0]) {^pp.modev $C $0 +} {^pp.modev $C * +}} {/echo *** You don't have ops on $C}}
  1245. alias munvop {^if (gotops($C)) {^if ([$0]) {^pp.modev $C $0 -} {^pp.modev $C * -}} {/echo *** You don't have ops on $C}}
  1246.  
  1247. # Fast mdop (x4)
  1248. alias fmdop {
  1249.     if (gotops($C))
  1250.     {
  1251.         if (match(*!*@* $0)) {@ UM = [$0]} {@ UM = [*!*@*]}
  1252.         foreach PP.USERS.$encode($tolower($C)) AA {
  1253.             if (decode($AA) != N)
  1254.             {
  1255.                 if ((ischanop($decode($AA) $C))&&(match($UM $decode($AA)!$word(2 $PP.USERS[$encode($tolower($C))][$AA])))) {@ MDOPZ = MDOPZ##[$decode($AA) ]}
  1256.             }
  1257.         }
  1258.         pp.listm.4 -oooo $C $MDOPZ
  1259.         ^assign -MDOPZ
  1260.         ^assign -UM
  1261.     } {/echo *** You don't have ops on $C}
  1262. }
  1263.  
  1264. # op and deop aliases
  1265. # op/deop <nicks>
  1266. alias op {^if ([$0]) {^pp.listm.3 +ooo $C $*} {/echo *** /op <nick> [<nick> ...]}}
  1267. alias deop {^if ([$0]) {^pp.listm.2 -oo $C $*} {/echo *** /deop <nick> [<nick> ...]}}
  1268.  
  1269. # masskick aliases
  1270. # masskick [<reason>] (kicks with mask *)  mkick [<mask>]
  1271. alias masskick {^if (gotops($C)) {^if ([$0]) {^pp.mkick $C * $*} {^pp.mkick $C * [Masskick: *]}} {/echo *** You don't have ops on $C}}
  1272. alias mkick {^if (gotops($C)) {^if ([$0]) {^pp.mkick $C $0 [Masskick: $0]} {^pp.mkick $C * [Masskick: *]}} {/echo *** You don't have ops on $C}}
  1273.  
  1274. # Kicks all non-operators on channel
  1275. alias lkick {
  1276.     if (gotops($C))
  1277.     {
  1278.         ^on ^who * {/if (([$1] != N)&&(!rmatch($2 *@*))) {//kick $0 $1 [Non-Operator Kick]}}
  1279.         //^who *
  1280.         wait -CMD ^on who -
  1281.     } {/echo *** You don't have ops on $C}
  1282. }
  1283.  
  1284. # massdcc <file> [<mask>]
  1285. alias massdcc {
  1286.     if ([$0])
  1287.     {
  1288.         if ([$1]) {@ DCCMASK = [$1]} {@ DCCMASK = [*]}
  1289.         ^on ^who * {^if (([$1] != N)&&(match(*${DCCMASK}* $1!$3@$4))) {@ DCCPPL = [$1 $DCCPPL]}}
  1290.         //^who *
  1291.         @ MDFILE = [$0]
  1292.         wait -CMD if (1) {
  1293.             ^on who -
  1294.             ^pp.listdcc $MDFILE $DCCPPL
  1295.             ^assign -DCCMASK
  1296.             ^assign -DCCPPL
  1297.             echo *** Sent DCC SEND request for $MDFILE to everyone in $C
  1298.             ^assign -MDFILE
  1299.         }
  1300.     } {/echo *** /massdcc <file> [<mask>]}
  1301. }
  1302.  
  1303. # Re-aliased to not require channel names
  1304. alias invite {^if (ischannel($1)) {//invite $*} {//invite $0 $C}}
  1305. alias kick {^if (ischannel($0)) {//kick $*} {//kick $C $0 $1-}}
  1306. alias mode {^if (ischannel($0)) {//mode $*} {^if ([$0] == N) {//mode $*} {//mode $C $*}}}
  1307.  
  1308. # pp.snm old new
  1309. # Snak adaptation 1.3 Snak has integrated highlighting
  1310. #alias pp.snm {
  1311. #    EVAL ^on raw_irc - "% PRIVMSG #% :*$0*"
  1312. #    EVAL ^on ^raw_irc "% PRIVMSG #% :*$1*" {
  1313. #        if (match(*ACTION* $3))
  1314. #        {
  1315. #            if ([$2] == C) {/xecho -window $winnum() -level PUBLIC * $nickonly($0) $strip( $4-)}
  1316. #            {/xecho -window $winnum() -level PUBLIC * $nickonly($0):$2 $strip( $4-)}
  1317. #        }
  1318. #        {
  1319. #            if ([$2] == C) {/xecho -window $winnum() -level PUBLIC <$nickonly($0)> $strip( $mid(1 65535 $3) $4-)}
  1320. #            {/xecho -window $winnum() -level PUBLIC <$nickonly($0):$2> $strip( $mid(1 65535 $3) $4-)}
  1321. #        }
  1322. #    }
  1323. #}
  1324.  
  1325. # Snak adaptation 1.3 Snak has integrated highlighting
  1326. alias nick {
  1327.     ^if ([$0])
  1328.     {
  1329. #        if (PP.SET.PMATCH == [.]) {^pp.snm $strip(_-[] $N) $strip(_-[] $0)}
  1330.         if (PP.DCC) {^dcc.onnick $*}
  1331.         quote NICK $*
  1332.     } {/nick $randcrap(9)}
  1333. }
  1334.  
  1335. # We don't use the -k$M method because of how the mode locking code works
  1336. alias clearmode {
  1337.     if (ischannel($0))
  1338.     {
  1339.         ^on ^324 * {@ CMODE = strip(:+ $2)##[ $3-]}
  1340.         //mode $0
  1341.         @ CMCHAN = [$0]
  1342.         wait -CMD if (1) {
  1343.             ^on 324 -
  1344.             //mode $CMCHAN -k$CMODE
  1345.             ^assign -CMCHAN
  1346.             ^assign -CMODE
  1347.         }
  1348.     } {/clearmode $C}
  1349. }
  1350.  
  1351. # Bans bots and bomb/inverse/beep/etc usernames
  1352. alias botban {//mode $C +bbb *b?t!*@* *srv!*@* *s?rv!*@*}
  1353. alias bot {//bot}
  1354.  
  1355. # pp.clearban <channel> <mask>
  1356. alias pp.clearban {
  1357.     @ BANMASK = [$1]
  1358.     ^on ^raw_irc "% 367 *" {^if ((match(*${BANMASK}* $4))||(match($4 $BANMASK))) {@ CBUNBAND = [$4 $CBUNBAND]}}
  1359.     //mode $0 b
  1360.     wait -CMD if (1) {
  1361.         ^pp.listunban $C $CBUNBAND
  1362.         ^assign -CBUNBAND
  1363.         ^assign -BANMASK
  1364.         ^on raw_irc - "% 367 *"
  1365.     }
  1366. }
  1367.  
  1368. # User clearban alias
  1369. # clearban [<mask>]
  1370. alias clearban {^if ([$0]) {^pp.clearban $C $*} {^pp.clearban $C *}}
  1371.  
  1372. # Unban alias: looks up user's user@host and runs a clearban
  1373. # unban <nick>
  1374. alias unban {
  1375.     if ([$0]) {
  1376.         if (match(*!*@* $0)) {^pp.listunban $C $*}
  1377.         {
  1378.             ^Userhost $0 -CMD if ([$3]) {
  1379.                 if ([$4] != [<UNKNOWN>]) {^pp.clearban $C $0!$3@$4} {/echo *** $0 is not on IRC}
  1380.             }
  1381.         }
  1382.     } {/echo *** /unban <nick/umask>}
  1383. }
  1384.         
  1385. # ban <nick>
  1386. alias ban {
  1387.     if ([$0])
  1388.     {
  1389.         if (match(*!*@* $0)) {//mode $C +bbb $*}
  1390.         {
  1391.             ^Userhost $0 -CMD if ([$3]) {
  1392.                 if ([$4] != [<UNKNOWN>])
  1393.                 {
  1394.                     @ HNAME = [$4]
  1395.                     if ((!isalpha($HNAME))&&(match(*.*.*.* $HNAME))) {@ ST = [*!*$mid(1 1000 $3)@]##left($rindex(. $HNAME) $HNAME)##[.*]}
  1396.                     {@ ST = [*!*$mid(1 1000 $3)@*$right(${@HNAME-index(. $4)} $4)]}
  1397.                     if (PP.SET.FUNKYBANS)
  1398.                     {
  1399.                         @ AA = []
  1400.                         @ CT = 0
  1401.                         while (CT < [$@ST])
  1402.                         {
  1403.                             @ SC = mid($CT 1 $ST)
  1404.                             if ((!match(*${SC}* @!.))&&(SC != [*]))
  1405.                             {
  1406.                                 if (rand(4) == 2) {@ AA = AA##[?]}
  1407.                                 {@ AA = AA##SC}
  1408.                             } {@ AA = AA##SC}
  1409.                             @ CT = CT + 1
  1410.                         }
  1411.                         ^assign -CT
  1412.                         ^assign -SC
  1413.                     } {@ AA = ST}
  1414.                     ^assign -ST
  1415.                     ^assign -HNAME
  1416.                     //mode $C +b $AA
  1417.                 } {/echo *** $0 is not on IRC}
  1418.             }
  1419.         }
  1420.     } {//mode $C b}
  1421. }
  1422.  
  1423. # /wordkick <channel> <word/phrase>
  1424. # or /wordkick <channel> off
  1425. alias wordkick {
  1426.     if ([$1])
  1427.     {
  1428.         if (ischannel($0)) {@ WCHAN = [$0]} {@ WCHAN = [#$0]}
  1429.         if ([$1] == [OFF])
  1430.         {
  1431.             foreach WORDKICKS AA {
  1432.                 if (decode($AA) == [$WCHAN])
  1433.                 {
  1434.                     EVAL ^on raw_irc - "% ??????% $decode($AA) :*$WORDKICKS[$AA]*"
  1435.                     ^assign -WORDKICKS[$AA]
  1436.                     @ WK = 1
  1437.                 }
  1438.             }
  1439.             if (WK) {/echo *** Wordkick for $WCHAN removed} {/echo *** There is no wordkick active on $WCHAN}
  1440.             ^assign -WK
  1441.         }
  1442.         {
  1443.             @ WORDKICKS[$encode($WCHAN)] = [$1-]
  1444.             EVAL ^on -raw_irc "% ??????% $WCHAN :*$1-*" {
  1445.                 //kick $2 $nickonly($0) [Wordkick]
  1446.             }
  1447.             echo *** Wordkick for '$1-' now active on channel $WCHAN
  1448.         }
  1449.         ^assign -WCHAN
  1450.     }
  1451.     {
  1452.         echo *** Active wordkicks:
  1453.         foreach WORDKICKS AA {/echo *** Channel: $[12]decode($AA) Word/phrase: $WORDKICKS[$AA]}
  1454.     }
  1455. }
  1456.  
  1457. # ----------------------------------------------------------------------------
  1458. # Friends and enemies lists handlers
  1459. # ----------------------------------------------------------------------------
  1460.  
  1461. # 'CK' is $encode(*)
  1462.  
  1463. # pp.addl <FRIENDS/ENEMIES> <umask> <channel/*>
  1464. alias pp.addl {
  1465.     if ((!match($1 $PP[$0][$encode($toupper($2))]))&&(!match($1 $PP[$0][CK])))
  1466.     {
  1467.         if (PP[$0][$encode($toupper($2))]) {@ PP[$0][$encode($toupper($2))] = PP[$0][$encode($toupper($2))]##[ $1]} {@ PP[$0][$encode($toupper($2))] = [$1]}
  1468.         if ([$2] == [*]) {/echo *** User mask [$1] added to global $tolower($0) list}
  1469.         {/echo *** User mask [$1] added to $tolower($0) list for channel mask $2}
  1470.     }
  1471.     {
  1472.         if ([$2] == [*]) {/echo *** A user mask matching [$1] is already on your global friends list}
  1473.         {/echo *** A user mask matching [$1] is already on the list for channel mask $2 or the global list}
  1474.     }
  1475. }
  1476. # pp.rml <FRIENDS/ENEMIES> <umask> <channel/*>
  1477. alias pp.rml {
  1478.     if ((match($1 $PP[$0][$encode($toupper($2))]))||(rmatch($1 $PP[$0][$encode($toupper($2))])))
  1479.     {
  1480.         @ CN = encode($toupper($2))
  1481.         @ AA = 0
  1482.         while (word($AA $PP[$0][$CN]))
  1483.         {
  1484.             if ((match($1 $word($AA $PP[$0][$CN])))||(match($word($AA $PP[$0][$CN]) $1)))
  1485.             {
  1486.                 ^delword $word($AA $PP[$0][$CN]) $PP[$0][$CN]
  1487.                 @ PP[$0][$CN] = NLIST
  1488.                 ^assign -NLIST
  1489.                 @ AA = 0
  1490.             } {@ AA = AA + 1}
  1491.         }
  1492.         if (!(word(0 $PP[$0][$CN]))) {^assign -PP[$0][$CN]}
  1493.         ^assign -CN
  1494.         if ([$2] == [*]) {/echo *** All patterns matching [$1] removed from global $tolower($0) list}
  1495.         {/echo *** All patterns matching [$1] removed from list for channel mask $2}
  1496.     }
  1497.     {
  1498.         if ([$2] == [*]) {/echo *** No patterns matching [$1] are on your global friends list}
  1499.         {/echo *** No patterns matching [$1] are on the list for channel mask $2 or the global list}
  1500.     }
  1501. }
  1502. # pp.rmlall <FRIENDS/ENEMIES> <umask>
  1503. alias pp.rmlall {
  1504.     EVAL ^foreach PP.$0 AB {
  1505.         if ((match($1 $PP[$0][$AB]))||(rmatch($1 $PP[$0][$AB]))) {^pp.rml $0 $1 $tolower($decode($AB))}
  1506.     }
  1507. }
  1508.  
  1509. # /friend <nick/umask> [<channel mask>]
  1510. alias friend {
  1511.     if ([$0])
  1512.     {
  1513.         if (match(*!*@* $0)) {^if ([$1]) {/pp.addl FRIENDS $0 $1} {/pp.addl FRIENDS $0 *}}
  1514.         {
  1515.             if ([$1]) {@ AA = [$1]} {@ AA = [*]}
  1516.             ^Userhost $0 -CMD if ([$3]) {
  1517.                 if ([$4] != [<UNKNOWN>])
  1518.                 {
  1519.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1520.                     ^pp.addl FRIENDS *!*$UHOST $AA
  1521.                     ^alias echo {}
  1522.                     ^pp.rml ENEMIES *!*$UHOST $AA
  1523.                     ^alias -echo
  1524.                     ^assign -UHOST
  1525.                     if (index(W $PP.SET) >= 0) {//^notice $0 [PurePak] You have been added to my friends list for channels matching [${AA}]: type /ctcp $N HELP for functions available to you}
  1526.                 } {/echo *** $0 is not on IRC}
  1527.             }
  1528.         }
  1529.     } {/echo *** /friend <nick/umask> [<channel mask>] (can contain wildcards)}
  1530. }
  1531. # /enemy <nick/umask> [<channel mask>]
  1532. alias enemy {
  1533.     if ([$0])
  1534.     {
  1535.         if (match(*!*@* $0)) {^if ([$1]) {/pp.addl ENEMIES $0 $1} {/pp.addl ENEMIES $0 *}}
  1536.         {
  1537.             if ([$1]) {@ AA = [$1]} {@ AA = [*]}
  1538.             ^Userhost $0 -CMD if ([$3]) {
  1539.                 if ([$4] != [<UNKNOWN>])
  1540.                 {
  1541.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1542.                     ^pp.addl ENEMIES *!*$UHOST $AA
  1543.                     ^alias echo {}
  1544.                     ^pp.rml FRIENDS *!*$UHOST $AA
  1545.                     ^alias -echo
  1546.                     ^assign -UHOST
  1547.                 } {/echo *** $0 is not on IRC}
  1548.             }
  1549.         }
  1550.     } {/echo *** /enemy <nick/umask> [<channel mask>] (can contain wildcards)}
  1551. }
  1552.  
  1553. # /rmfriend <nick/umask> [<channel mask>]
  1554. alias rmfriend {
  1555.     if ([$0])
  1556.     {
  1557.         if (match(*!*@* $0)) {^if ([$1]) {/pp.rml FRIENDS $0 $1} {/pp.rmlall FRIENDS $0}}
  1558.         {
  1559.             if ([$1]) {@ AA = [$1]} {@ AA = [AA]}
  1560.             ^Userhost $0 -CMD if ([$3]) {
  1561.                 if ([$4] != [<UNKNOWN>])
  1562.                 {
  1563.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1564.                     if (AA == [AA]) {^pp.rmlall FRIENDS *!*$UHOST} {^pp.rml FRIENDS *!*$UHOST $AA}
  1565.                     ^assign -UHOST
  1566.                 } {/echo *** $0 is not on IRC}
  1567.             }
  1568.         }
  1569.     } {/echo *** /rmfriend <nick/umask> [<channel mask>] (can contain wildcards)}
  1570. }
  1571. # /rmenemy <nick/umask> [<channel mask>]
  1572. alias rmenemy {
  1573.     if ([$0])
  1574.     {
  1575.         if (match(*!*@* $0)) {^if ([$1]) {/pp.rml ENEMIES $0 $1} {/pp.rmlall ENEMIES $0}}
  1576.         {
  1577.             if ([$1]) {@ AA = [$1]} {@ AA = [AA]}
  1578.             ^Userhost $0 -CMD if ([$3]) {
  1579.                 if ([$4] != [<UNKNOWN>])
  1580.                 {
  1581.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1582.                     if (AA == [AA]) {^pp.rmlall ENEMIES *!*$UHOST} {^pp.rml ENEMIES *!*$UHOST $AA}
  1583.                     ^assign -UHOST
  1584.                 } {/echo *** $0 is not on IRC}
  1585.             }
  1586.         }
  1587.     } {/echo *** /rmenemy <nick/umask> [<channel mask>] (can contain wildcards)}
  1588. }
  1589.  
  1590. alias nofriends {/rmfriend *!*@*}
  1591. alias noenemies {/rmenemy *!*@*}
  1592.  
  1593. alias lsfriends {
  1594.     echo *** Channel Mask   Patterns
  1595.     if (PP.FRIENDS.CK) {/echo *** [Global (*)]   $PP.FRIENDS.CK}
  1596.     foreach PP.FRIENDS AA {
  1597.         if (AA != [CK])
  1598.         {
  1599.             @ CM = tolower($decode($AA))
  1600.             echo *** $[14]CM $PP.FRIENDS[$AA]
  1601.         }
  1602.     }
  1603.     ^assign -CM
  1604. }
  1605. alias lsenemies {
  1606.     echo *** Channel Mask   Patterns
  1607.     if (PP.ENEMIES.CK) {/echo *** [Global (*)]   $PP.ENEMIES.CK}
  1608.     foreach PP.ENEMIES AA {
  1609.         if (AA != [CK])
  1610.         {
  1611.             @ CM = tolower($decode($AA))
  1612.             echo *** $[14]CM $PP.ENEMIES[$AA]
  1613.         }
  1614.     }
  1615.     ^assign -CM
  1616. }
  1617.  
  1618. # ----------------------------------------------------------------------------
  1619. # Miscellaneous user aliases
  1620. # ----------------------------------------------------------------------------
  1621.  
  1622. # pp.mmsg <PRIVMSG/NOTICE> <who status match> <msg>
  1623. alias pp.mmsg {
  1624.     @ STATP = [$1]
  1625.     ^on ^who * {^if (([$1] != N)&&(match($STATP $2))) {@ MSGNICKS = [$1 ]##MSGNICKS}}
  1626.     @ SEND_TYPE = [$0]
  1627.     @ SEND_MSG = [$2-]
  1628.     //^who *
  1629.     wait -CMD if (1) {
  1630.         ^on who -
  1631.         ^pp.listmsg $SEND_TYPE $MSGNICKS
  1632.         if (SEND_TYPE == [NOTICE])
  1633.         {
  1634.             @ EC.1 = [-]
  1635.             @ EC.2 = [-]
  1636.         }
  1637.         {
  1638.             @ EC.1 = [[]
  1639.             @ EC.2 = []]
  1640.         }
  1641.         if (STATP == [*@*]) {/echo -> ${EC.1}OPS@$C${EC.2} $SEND_MSG} {/echo -> ${EC.1}*@$C${EC.2} $SEND_MSG}
  1642.         ^assign -EC.1
  1643.         ^assign -EC.2
  1644.         ^assign -SEND_TYPE
  1645.         ^assign -SEND_MSG
  1646.         ^assign -MSGNICKS
  1647.         ^assign -STATP
  1648.     }
  1649. }
  1650.  
  1651. # Mass msg'ing aliases
  1652. alias msgall {^if ([$0]) {^pp.mmsg PRIVMSG * $*} {/echo *** /msgall <msg>}}
  1653. alias msgops {^if ([$0]) {^pp.mmsg PRIVMSG *@* $*} {/echo *** /msgops <msg>}}
  1654. alias wallops {^if ([$0]) {^pp.mmsg NOTICE *@* [WallOps:${C}] $*} {/echo *** /wallops <msg> (Use //wallops to use IRC's original wallops command)}}
  1655. alias wall {/wallops $*}
  1656.  
  1657. # So that help servers won't trigger flood protection
  1658. alias help {
  1659.     EVAL ^on -flood "$help_service *" {}
  1660.     EVAL ^timer 60 ^on flood - "$help_service *"
  1661.     //help $*
  1662. }
  1663.  
  1664. alias finger {
  1665.     if ([$0])
  1666.     {
  1667.         if (match(*@* $0)) {/exec $PP.SET.FINGERCMD $0}            
  1668.         {
  1669.             ^Userhost $0 -CMD if ([$3]) {^if ([$3] != [<UNKNOWN>]) {/exec $PP.SET.FINGERCMD $strip(~ $3)@$4} {/echo *** $0 is not on IRC}}
  1670.         }
  1671.     } {/echo *** /finger <nick> -or- /finger <user@host>}
  1672. }
  1673.  
  1674. # Uncompressing /load command
  1675. on ^exec "uncomp *" {/echo *** Output from uncompress program: $1-}
  1676. alias load {
  1677.     if ([$0])
  1678.     {
  1679.         if (right(3 $0) == [.gz]) {@ COMPRESS.ISCOMP = PP.SET.UNGZCMD}
  1680.         if (right(2 $0) == [.Z]) {@ COMPRESS.ISCOMP = PP.SET.UNZCMD}
  1681.         if (COMPRESS.ISCOMP)
  1682.         {
  1683.             ^set input_prompt [$0] Uncompressing and loading...
  1684.             @ COMPRESS.PIPENAME = [/tmp/pptmp]##rand(99999999)
  1685.             @ CMPFILE = [$0]
  1686.             exec -name mknod $PP.SET.MKNODCMD $COMPRESS.PIPENAME p
  1687.             wait -CMD %mknod if (1) {
  1688.                 exec -name uncomp $COMPRESS.ISCOMP $CMPFILE >>$COMPRESS.PIPENAME
  1689.                 //load $COMPRESS.PIPENAME
  1690.                 exec -name rm $PP.SET.RMCMD $COMPRESS.PIPENAME
  1691.                 ^assign -CMPFILE
  1692.                 ^assign -COMPRESS.PIPENAME
  1693.                 ^assign -COMPRESS.ISCOMP
  1694.                 ^set -input_prompt
  1695.             }
  1696.         }
  1697.         {
  1698.             ^set input_prompt [$0] Loading...
  1699.             //load $*
  1700.             ^set -input_prompt
  1701.         }
  1702.     } {//load}
  1703. }
  1704.  
  1705. alias names {^if ([$0]) {//names $*} {/if (ischannel($C)) {//names $C}}}
  1706. alias chops {^if ([$0]) {/who $0 -chops} {/who $C -chops}}
  1707.  
  1708. alias bk {
  1709.     if ([$0])
  1710.     {
  1711.         ^ban $0
  1712.         @ KN = [$0]
  1713.         ^assign KR $1-
  1714.         wait -CMD if (1) {
  1715.             //^kick $C $KN $KR
  1716.             ^assign -KN
  1717.             ^assign -KR
  1718.         }
  1719.     } {/echo *** /bk <nick> [<reason>]}
  1720. }
  1721.  
  1722. alias leave {^if ([$0]) {^if (ischannel($0)) {//leave $*} {//leave #$*}} {//leave $C}}
  1723. alias part {/leave $*}
  1724. alias join {^if ((ischannel($0))||(match(-* $0))) {//join $*} {//join #$*}}
  1725.  
  1726. # Yet another command that is destined to show up in tons of other scripts :)
  1727. # /avoid <nick> or /avoid - <nick> ... just /avoid displays a list
  1728. alias avoid {
  1729.     if ([$0])
  1730.     {
  1731.         if ([$0] == [-])
  1732.         {
  1733.             if ([$1])
  1734.             {
  1735.                 if (match($1 $PP.SET.AVOID))
  1736.                 {
  1737.                     ^delword $1 $PP.SET.AVOID
  1738.                     @ PP.SET.AVOID = NLIST
  1739.                     ^assign -NLIST
  1740.                     echo *** Nick $1 removed from aviodance list
  1741.                 }
  1742.                 {
  1743.                     if ([$1] == [*])
  1744.                     {
  1745.                         ^assign -PP.SET.AVOID
  1746.                         echo *** Avoidance list cleared
  1747.                     } {/echo *** Nick $1 is not on your avoidance list}
  1748.                 }
  1749.             } {/echo *** /avoid - <nick>}
  1750.         }
  1751.         {
  1752.             if (match($1 $PP.SET.AVOID)) {/echo *** Nick $0 is already on your avoidance list}
  1753.             {
  1754.                 @ PP.SET.AVOID = PP.SET.AVOID##[$0 ]
  1755.                 echo *** Nick $0 added to avoidance list
  1756.                 if (!match($0 $PP.SET.NOTIFY)) {^notify $0}
  1757.             }
  1758.         }
  1759.     } {/echo *** Avoidance list: $PP.SET.AVOID}
  1760. }
  1761.  
  1762. alias cstats {
  1763.     @ CSOPS = 0
  1764.     @ CSNOPS = 0
  1765.     @ CSOPERS = 0
  1766.     @ CSHERE = 0
  1767.     @ CSGONE = 0
  1768.     @ CSUCOUNT = 0
  1769.     @ CSFARTHEST = 0
  1770.     ^on ^who * {
  1771.         if (match(*@* $2)) {@ CSOPS = CSOPS + 1} {@ CSNOPS = CSNOPS + 1}
  1772.         if ((mid(1 1 $2) == [*])||(mid(2 1 $2) == [*])) {@ CSOPERS = CSOPERS + 1}
  1773.         if (match(*H* $2)) {@ CSHERE = CSHERE + 1} {@ CSGONE = CSGONE + 1}
  1774.         @ CSUCOUNT = CSUCOUNT + 1
  1775.         if ([$5] > CSFARTHEST) {@ CSFARTHEST = [$5]}
  1776.     }
  1777.     if (ischannel($0)) {@ CSCHAN = [$0]} {@ CSCHAN = C}
  1778.     //^who $CSCHAN
  1779.     wait -CMD if (1) {
  1780.         ^on who -
  1781.         echo *** Stats for channel ${CSCHAN}:
  1782.         echo *** Total Users:${CSUCOUNT}   Ops:${CSOPS}   Non-ops:${CSNOPS}   IRCOps:${CSOPERS}
  1783.         echo *** Here:${CSHERE}   Away:${CSGONE}   Server hops to farthest user:${CSFARTHEST}
  1784.         ^assign -CSOPS
  1785.         ^assign -CSNOPS
  1786.         ^assign -CSCHAN
  1787.         ^assign -CSOPERS
  1788.         ^assign -CSHERE
  1789.         ^assign -CSGONE
  1790.         ^assign -CSUCOUNT
  1791.         ^assign -CSFARTHEST
  1792.     }
  1793. }
  1794.  
  1795. # We alias the notify list so we can keep track of it and save it with /sve
  1796. alias pp.notifychk {
  1797.     if ([$0] == [-]) {^assign -PP.SET.NOTIFY}
  1798.     {
  1799.         @ AA = 0
  1800.         while (word($AA $*))
  1801.         {
  1802.             if (match(-* $word($AA $*)))
  1803.             {
  1804.                 if (PP.SET.NOTIFY)
  1805.                 {
  1806.                     ^delword $mid(1 1000 $word($AA $*)) $PP.SET.NOTIFY
  1807.                     @ PP.SET.NOTIFY = NLIST
  1808.                     ^assign -NLIST
  1809.                 }
  1810.             }
  1811.             {
  1812.                 if (!match($word($AA $*) $PP.SET.NOTIFY)) {@ PP.SET.NOTIFY = PP.SET.NOTIFY##[$word($AA $*) ]}
  1813.             }
  1814.             @ AA = AA + 1
  1815.         }
  1816.     }
  1817. }
  1818. alias notify {
  1819.     //notify $*
  1820.     if ([$0]) {^pp.notifychk $*}
  1821. }
  1822.  
  1823. alias version {
  1824.     if ([$0]) {^if (match(*.* $0)) {//version $*} {//ctcp $0 VERSION}}
  1825.     {
  1826.         //version
  1827.         echo *** PurePak: version $PPVERS
  1828.     }
  1829. }
  1830.  
  1831. alias rwhois {^if ([$0]) {/whois $0 $0} {/whois $N}}
  1832. alias whois {
  1833.     @ WHOISINPROGRESS = 1
  1834.     //whois $*
  1835.     wait -CMD if (1) {^timer 2 ^assign -WHOISINPROGRESS}
  1836. }
  1837.  
  1838. # /nslookup <nick> or /nslookup <ip address>
  1839. alias nslookup {
  1840.     if ([$0])
  1841.     {
  1842.         if (match(*.* $0)) {^pp.dolookup $0}
  1843.         {
  1844.             ^Userhost $0 -CMD if ([$3]) {
  1845.                 if ([$4] != [<UNKNOWN>])
  1846.                 {
  1847.                     if (!isalpha($4)) {^pp.dolookup $4}
  1848.                     {/echo *** $0 is not online as an IP address}
  1849.                 } {/echo *** $0 is not on IRC}
  1850.             }
  1851.         }
  1852.     } {/echo *** /nslookup <nick> -or- /nslookup <ip address>}
  1853. }
  1854. alias pp.dolookup {
  1855.     if (!LOOKINGUP)
  1856.     {
  1857.         exec -name NSLOOKUP $PP.SET.NSLOOKCMD $0
  1858.         @ IPAD = [$0]
  1859.         @ LOOKINGUP = 1
  1860.     }
  1861. }
  1862. on ^exec "NSLOOKUP *" {}
  1863. on ^exec_error "NSLOOKUP *" {}
  1864. on ^exec "NSLOOKUP *Name*" {^pp.gn $*}
  1865. on ^exec_error "NSLOOKUP *Name*" {^pp.gn $*}
  1866. on ^exec_exit "NSLOOKUP *" {
  1867.     if (NSHOST) {/echo *** $IPAD is ${NSHOST}} {/echo *** Could not resolve a hostname for $IPAD}
  1868.     ^assign -NSHOST
  1869.     ^assign -IPAD
  1870.     ^assign -LOOKINGUP
  1871. }
  1872. alias pp.gn {
  1873.     @ AA = 0
  1874.     while (word($AA $*))
  1875.     {
  1876.         if (match(*.* $word($AA $*))) {@ NSHOST = word($AA $*)}
  1877.         @ AA = AA + 1
  1878.     }
  1879. }
  1880.  
  1881. alias ig {
  1882.     if ([$0])
  1883.     {
  1884.         ^Userhost $0 -CMD if ([$3]) {
  1885.             if ([$4] != [<UNKNOWN>]) {/ignore *$strip(~ $3)@$4 MSG NOTICE CTCP PUBLIC} {/echo *** $0 is not on IRC}
  1886.         }
  1887.     } {/echo *** /ig <nick>}
  1888. }
  1889. alias unig {
  1890.     if ([$0])
  1891.     {
  1892.         ^Userhost $0 -CMD if ([$3]) {
  1893.             if ([$4] != [<UNKNOWN>]) {/ignore *$strip(~ $3)@$4 NONE} {/echo *** $0 is not on IRC}
  1894.         }
  1895.     } {/echo *** /unig <nick>}
  1896. }
  1897. # Snak adaptation 1.2. Snaks ischanop is correct and these checks take time
  1898. # Snak adaptation 1.4. Don't reformat /who output - take out alias aw
  1899. alias who {
  1900.     if ((!DOINGWHO)&&(!SYNCING))
  1901.     {
  1902. #        ^on ^who * {
  1903. #            @ PP.USERS[$WINNUM()][$encode($tolower($0))][$encode($tolower($1))] = [$0 $1 $3@$4]
  1904. #            if (match(*@* $2))
  1905. #            {
  1906. #                if ((!ischanop($1 $0))&&(!PP.ICWARNED))
  1907. #                {
  1908. #                    echo *** Warning: your client's ischanop() function is inaccurate \($1 is op, ischanop() reports not op\)\; channel op status on /users lists may be wrong
  1909. #                    @ PP.ICWARNED = 1
  1910. #                }
  1911. #            }
  1912. #            {
  1913. #                if ((ischanop($1 $0))&&(!PP.ICWARNED))
  1914. #                {
  1915. #                    echo *** Warning: your client's ischanop() function is inaccurate \($1 is not op, ischanop() reports op\)\; channel op status on /users lists may be wrong
  1916. #                    @ PP.ICWARNED = 1~
  1917. #                }
  1918. #            }
  1919. #            aw $*
  1920. #        }
  1921. #        ^if (!PP.EPIC) {^alias aw {/xecho -level CRAP $[10]0 $[9]1 $[3]2 [$[2]5]  $3@$4 \($6-\)}}
  1922. #        {^alias aw {/xecho -level CRAP $[10]0 $[9]1 $[3]2 [$[2]6]  $3@$4 \($7-\)}}
  1923.         if ([$0]) {//who $*} {//who *}
  1924. #        @ DOINGWHO = 1
  1925. #        ^wait -CMD if (1) {
  1926. #            ^alias -aw
  1927. #            ^on who -
  1928. #            ^assign -DOINGWHO
  1929. #        }
  1930.     } {^if (SYNCING) {/echo *** /users synchronization in progress\; try again in a few seconds}}
  1931. }
  1932.  
  1933. alias serv {//server $*}
  1934. alias umode {//mode $N $*}
  1935.  
  1936. # Unflash command that should work on ALL clients
  1937. alias unflash {
  1938.     if (V <= 19930629)
  1939.     {
  1940.         ^set status_clock c
  1941.         ^type ^L
  1942.         ^set status_clock \;\24r
  1943.         ^type ^L
  1944.         ^set status_clock m
  1945.         ^type ^L
  1946.         ^set status_clock ?5l
  1947.         ^type ^L
  1948.         sleep 1
  1949.         ^set status_clock  %T
  1950.         ^type ^L
  1951.         echo *** Screen restored
  1952.     }
  1953.     {
  1954.         if ([$TTY])
  1955.         {
  1956.             if (match(*/* $TTY)) {^assign MYTTY $TTY} {^assign MYTTY /dev/$TTY}
  1957.             ^exec -name unflash echo c >>$MYTTY
  1958.             ^exec -name unflash echo \\\;\24r >>$MYTTY
  1959.             ^exec -name unflash echo m >>$MYTTY
  1960.             ^exec -name unflash echo ?5l >>$MYTTY
  1961.             ^exec -name unflash reset >>$MYTTY
  1962.             wait -CMD %unflash if (1) {
  1963.                 ^type ^L
  1964.                 ^assign -MYTTY
  1965.                 echo *** Screen restored
  1966.             }
  1967.         } {/echo *** UNFLASH FAILED: ENVIRONMENT VARIABLE 'TTY' MUST BE SET TO YOUR TTY.  SEE README.PPK}
  1968.     }
  1969. }
  1970.  
  1971. alias mail {
  1972.     if ([$0])
  1973.     {
  1974.         ^assign MAILFILE $1-
  1975.         ^Userhost $0 -CMD if ([$3]) {
  1976.             if ([$3] != [<UNKNOWN>])
  1977.             {
  1978.                 exec $PP.SET.MAILCMD $strip(~ $3)@$4 < $MAILFILE
  1979.                 echo *** Mailed $MAILFILE to $strip(~ $3)@$4
  1980.                 ^assign -MAILFILE
  1981.             } 
  1982.             {
  1983.                 echo *** $0 is not on IRC
  1984.                 ^assign -MAILFILE
  1985.             }
  1986.         }
  1987.     } {/echo *** /mail <nick> <file>}
  1988. }
  1989. alias uumail {
  1990.     if ([$0]) {
  1991.         ^assign MAILFILE $1-
  1992.         ^Userhost $0 -CMD if ([$3]) {
  1993.             if ([$3] != [<UNKNOWN>])
  1994.             {
  1995.                 exec $PP.SET.UUECMD $MAILFILE $MAILFILE | $PP.SET.MAILCMD $strip(~ $3)@$4
  1996.                 echo *** Mailed $MAILFILE to $strip(~ $3)@$4 (uuencoded)
  1997.                 ^assign -MAILFILE
  1998.             }
  1999.             {
  2000.                 echo *** $0 is not on IRC
  2001.                 ^assign -MAILFILE
  2002.             }
  2003.         }
  2004.     } {/echo *** /uumail <nick> <file>}
  2005. }
  2006.  
  2007. alias topic {^if (ischannel($0)) {//topic $*} {//topic $C $*}}
  2008.  
  2009. alias net {
  2010.     if ([$0])
  2011.     {
  2012.         echo *** Creating a window on server $0
  2013.         echo *** Type ^W to switch between windows and /wk to kill the current window.
  2014.         window new
  2015.         if ([$1]) {/EVAL window server $0:$1::_$N} {/EVAL window server $0:6667::_$N}
  2016.     }
  2017.     {
  2018.         echo *** /net <server> [<port>]
  2019.         echo ***
  2020.         echo *** /net creates a new window and connects it to <server>.  To
  2021.         echo *** switch windows, hit ^W
  2022.         echo ***
  2023.         echo *** /wk kills the current window.
  2024.         echo *** /wh hides the current window.
  2025.         echo *** /ws shows all windows.
  2026.     }
  2027. }
  2028. alias wk {/window kill}
  2029. alias wh {/window hide}
  2030. alias ws {
  2031.     window show 2
  2032.     window show 1
  2033.     window balance
  2034. }
  2035.  
  2036. alias massinv {
  2037.     if ([$0])
  2038.     {
  2039.         ^on ^who * {
  2040.             if (([$1] != N)&&([$0] != C)) {/EVAL ^timer $rand(30) //invite $1 $C}
  2041.         }
  2042.         echo *** Inviting users found with command '/who $*' to channel $C
  2043.         //^who $*
  2044.         wait -CMD ^on who -
  2045.     } {/echo *** /massinv <who params>   - Where <who params> is exactly as if it were a /who command.}
  2046. }
  2047.     
  2048. alias cycle {lj}
  2049. alias lj {
  2050.     @ OC = C
  2051.     //leave $C
  2052.     wait -CMD if (1) {
  2053.         //join $OC
  2054.         ^assign -OC
  2055.     }
  2056. }
  2057.  
  2058. alias signoff {
  2059.     if ([$0])
  2060.     {
  2061.         echo *** Signoff: $N \($*\)
  2062.         //signoff $*
  2063.     }
  2064.     {
  2065.         echo *** Signoff: $N \(Leaving\)
  2066.         //signoff Leaving
  2067.     }
  2068. }
  2069. alias exit {/signoff $*}
  2070. alias quit {/signoff $*}
  2071. alias bye {/signoff $*}
  2072.  
  2073. alias ls {/exec $PP.SET.LSCMD $*}
  2074. alias lsw {
  2075.     @ OLDTABMAX = TAB_MAX
  2076.     ^set TAB_MAX 64
  2077.     exec -name lsw $PP.SET.LSWCMD $*
  2078.     wait -CMD %lsw if (1) {
  2079.         ^set TAB_MAX $OLDTABMAX
  2080.         ^assign -OLDTABMAX
  2081.     }
  2082. }
  2083. alias rm {^if ([$0]) {/exec $PP.SET.RMCMD $*} {/echo *** /rm [<rm options>] <filenames>}}
  2084. alias cat {^if ([$0]) {/exec $PP.SET.CATCMD $*} {/echo *** /cat <filename>}}
  2085. on ^exec "MSGCAT *" {
  2086.     if (!match(=* $MCAT))
  2087.     {
  2088.         ^timer $MCATCTR //msg $MCAT $1-
  2089.         @ MCATCTR = MCATCTR + (rand(2) + 1)
  2090.     } {//msg $MCAT $1-}
  2091. }
  2092. on ^exec_exit "MSGCAT *" {
  2093.     ^assign -MCAT
  2094.     ^assign -MCATCTR
  2095. }
  2096. alias catto {
  2097.     if ([$1])
  2098.     {
  2099.         @ MCAT = [$0]
  2100.         @ MCATCTR = 2
  2101.         exec -name MSGCAT $PP.SET.CATCMD $1
  2102.     }
  2103.     {^if ([$0]) {/catto $C $0} {/echo *** /catto <nick/channel> <file> -or- /catto <file> (goes to current channel)}}
  2104. }
  2105. alias ps {/exec $PP.SET.PSCMD $*}
  2106. alias pskill {^if ([$0]) {/exec $PP.SET.KILLCMD $*} {/echo *** /pskill <pid(s) to kill>}}
  2107.  
  2108. alias pp.awaylog {
  2109.     ^assign AWAYLOG[$PP.AWAYLCTR] $*
  2110.     if (PBFILE) {^pp.playback $*}
  2111.     @ PP.AWAYLCTR = PP.AWAYLCTR + 1
  2112. }
  2113. alias pp.pe {^if (PBFILE) {^msg %pbfile $strip( $*)} {/echo $*}}
  2114. alias pp.playback {
  2115.     if ([$1] == [MSG]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] [$3!$strip(~ $2)] $4-}
  2116.     if ([$1] == [NOTICE]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] -$3!$strip(~ $2)- $4-}
  2117.     if ([$1] == [KICK]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] Kicked from $4 by $3 [$strip(~ $2)] \($5-\)}
  2118.     if ([$1] == [BAN]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] banned you from $4 with bans: $5-}
  2119.     if ([$1] == [FLOOD]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $4- from $3 [$strip(~ $2)] detected}
  2120.     if ([$1] == [DEOP]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] deopped you on $4}
  2121.     if ([$1] == [OP]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] opped you on $4}
  2122.     if ([$1] == [DCC]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] DCC $4 \($5\) received from $2 [$strip(~ $3)]}
  2123. }
  2124. alias playback {
  2125.     if (AWAYLOG[0])
  2126.     {
  2127.         if (PBFILE)
  2128.         {
  2129.             @ PBFILE_OLD = PBFILE
  2130.             ^assign -PBFILE
  2131.         }
  2132.         @ CTR = 0
  2133.         ^pp.pauseset
  2134.         while (CTR <= PP.AWAYLCTR)
  2135.         {
  2136.             ^pp.playback $AWAYLOG[$CTR]
  2137.             @ CTR = CTR + 1
  2138.         }
  2139.         ^pp.pauseend
  2140.         ^assign -CTR
  2141.         if (PBFILE_OLD)
  2142.         {
  2143.             @ PBFILE = PBFILE_OLD
  2144.             ^assign -PBFILE_OLD
  2145.         }
  2146.     } {/echo *** No messages or events to play back}
  2147. }
  2148. alias clearlog {
  2149.     foreach AWAYLOG AA {^assign -AWAYLOG[$AA]}
  2150.     @ PP.AWAYLCTR = 0
  2151.     echo *** Away log is now empty
  2152. }
  2153.             
  2154. alias away {
  2155.     if (!(A))
  2156.     {
  2157.         if ([$0]) {//away $*}
  2158.         {
  2159.             if (index(G $PP.SET) >= 0) {//away All messages will be logged...} {//away Gone...}
  2160.         }
  2161.         wait -CMD if (1) {
  2162.             if ((!!(C))&&(index(O $PP.SET) >= 0))
  2163.             {
  2164.                 ^assign SEND_MSG ACTION is away: ${A}
  2165.                 ^pp.listmsg PRIVMSG $mychannels()
  2166.                 ^assign -SEND_MSG
  2167.                 echo * $N is away: $A
  2168.             }
  2169.         }
  2170.         if (index(H $PP.SET) >= 0)
  2171.         {
  2172.             ^assign PBFILE $PP.SET.ALFILE
  2173.             ^exec -name pbfile $PP.SET.CATCMD >>$PBFILE
  2174.             echo *** Away log file ${PBFILE} opened
  2175.         }
  2176.         @ PP.AWAYSINCE = Z
  2177.     }
  2178.     {
  2179.         //away
  2180.         wait -CMD if (1) {
  2181.             ^assign -PP.AWAYSINCE
  2182.             if (index(G $PP.SET) >= 0) {/echo *** Type /playback to play back away log, type /clearlog to clear away log.}
  2183.             if ((!!(C))&&(index(O $PP.SET) >= 0))
  2184.             {
  2185.                 ^assign SEND_MSG ACTION is back.
  2186.                 ^pp.listmsg PRIVMSG $mychannels()
  2187.                 ^assign -SEND_MSG
  2188.                 echo * $N is back.
  2189.             }
  2190.         }
  2191.         if (index(H $PP.SET) >= 0)
  2192.         {
  2193.             ^exec -close %pbfile
  2194.             echo *** Away log file ${PBFILE} closed
  2195.             ^assign -PBFILE
  2196.         }
  2197.     }
  2198. }
  2199.  
  2200. # paway <nick> <msg/->
  2201. alias paway {
  2202.     if ([$0])
  2203.     {
  2204.         if ([$1])
  2205.         {
  2206.             if ([$1] == [-])
  2207.             {
  2208.                 ^assign -PP.PAWAYS[$encode($toupper($0))]
  2209.                 echo *** Personal away message for $0 removed
  2210.             }
  2211.             {
  2212.                 @ PP.PAWAYS[$encode($toupper($0))] = [$1-]
  2213.                 echo *** Personal away message for $0 added: $1-
  2214.             }
  2215.         }
  2216.         {
  2217.             if (PP.PAWAYS[$encode($toupper($0))]) {/echo *** Personal away message for $0: $PP.PAWAYS[$encode($toupper($0))]}
  2218.             {/echo *** No personal away message set for $0}
  2219.         }
  2220.     }
  2221.     {
  2222.         echo *** Nick       Message
  2223.         foreach PP.PAWAYS AA {/echo *** $[10]decode($AA) $PP.PAWAYS[$AA]}
  2224.     }
  2225. }
  2226.  
  2227. alias write {/comment $write($*)}
  2228. alias sve {
  2229.     if (!(HOME))
  2230.     {
  2231.         exec -name rm $PP.SET.RMCMD $PP.SAVEFILE
  2232.         echo *** Warning: Your home directory could not be determined.  Your saved settings file will be saved to the current working directory.  If this isn't your home directory, PurePak may not be able to find it's saved settings file at startup!
  2233.     } {/exec -name rm $PP.SET.RMCMD ${HOME}/$PP.SAVEFILE}
  2234.     wait -CMD %rm if (1) {
  2235.         if (PP.EPIC)
  2236.         {
  2237.             if (!(HOME)) {@ FHANDLE = open($PP.SAVEFILE w)} {@ FHANDLE = open(${HOME}/$PP.SAVEFILE w)}
  2238.             if (FHANDLE > 0) {/EVAL ^assign WM /write $FHANDLE}
  2239.             {
  2240.                 echo *** Could not open target file!
  2241.                 @ WM = [/comment]
  2242.             }
  2243.         }
  2244.         {
  2245.             @ WM = [/xecho -WINDOW WRITEOUT]
  2246.             ^window new
  2247.             ^window hold_mode off
  2248.             ^window name WRITEOUT
  2249.             if (!(HOME)) {^window logfile $PP.SAVEFILE} {^window logfile ${HOME}/$PP.SAVEFILE}
  2250.             ^window log on
  2251.         }
  2252.         $WM # PurePak version $PPVERS saved settings file
  2253.         $WM # Written $stime($time())
  2254.         foreach PP.SET AA {$WM @ PP.SET.$AA = [$PP.SET[$AA]]}
  2255.         foreach PP.PAWAYS AA {$WM @ PP.PAWAYS.$AA = [$PP.PAWAYS[$AA]]}
  2256.         $WM @ PP.SET = [$PP.SET]
  2257.         $WM ^set beep_on_msg $beep_on_msg
  2258.         $WM ^set flood_rate $flood_rate
  2259.         $WM ^set flood_after $flood_after
  2260.         $WM ^set shell $shell
  2261.         $WM ^set suppress_server_motd $suppress_server_motd
  2262.         foreach PP.FRIENDS AA {$WM @ PP.FRIENDS[$AA] = [$PP.FRIENDS[$AA]]}
  2263.         foreach PP.ENEMIES AA {$WM @ PP.ENEMIES[$AA] = [$PP.ENEMIES[$AA]]}
  2264.         $WM ^pp.savedfrom $strip(.ba $PPVERS)
  2265.         $WM echo *** Saved settings loaded from ${PP.SAVEFILE}
  2266.         if (match(*xecho* $WM))
  2267.         {
  2268.             ^window log off
  2269.             ^window kill
  2270.         }
  2271.         {
  2272.             comment $close($FHANDLE)
  2273.             ^assign -FHANDLE
  2274.         }
  2275.         ^assign -WM
  2276.         echo *** Current settings saved to ${PP.SAVEFILE}
  2277.     }
  2278. }
  2279. alias pp.savedfrom {
  2280.     if ([$0] < 109)
  2281.     {
  2282.         ^alias echo {}
  2283.         foreach FRIENDS AA {
  2284.             ^pp.addl FRIENDS $FRIENDS[$AA] *
  2285.             ^assign -FRIENDS[$AA]
  2286.         }
  2287.         foreach ENEMIES AA {
  2288.             ^pp.addl ENEMIES $ENEMIES[$AA] *
  2289.             ^assign -ENEMIES[$AA]
  2290.         }
  2291.         ^alias -echo
  2292.         ^timer 30 /echo *** Your old friends/enemies lists from your previous version of PurePak have been added to the 'global' friends/enemies lists in this version.  You should /sve now to save the lists in the new format. (Type /lsfriends and /lsenemies to check your lists)
  2293.     }
  2294.     if ([$0] < 205)
  2295.     {
  2296.         foreach PP.PAWAYS AA {
  2297.             @ PP.PAWAYS[$encode($toupper($AA))] = PP.PAWAYS[$AA]
  2298.             ^assign -PP.PAWAYS[$AA]
  2299.             ^timer 30 /echo *** There have been changes to the saved file format.  Auto-converted, but you should /sve now so you don't see this message again.
  2300.         }
  2301.     }
  2302.     ^timer 5 ^alias -pp.savedfrom
  2303. }
  2304.  
  2305. # So the "IRC log started ..." comments in the logfile do nothing
  2306. alias IRC {}
  2307. alias pphelp {
  2308.     if ([$0]) {
  2309.         if (!(PPHELP.HELP)) 
  2310.         {
  2311.             ^set input_prompt Loading help database...
  2312.             //^load purepak.hlp
  2313.             ^set -input_prompt
  2314.             if (!(PPHELP.HELP)) {/echo *** Error loading purepak.hlp: check to make sure that the file exists and is in a directory where it can be found.} {/pphelp $*}
  2315.         }
  2316.         {
  2317.             @ PP.HELPLASTUSED = time()
  2318.             if ([$1]) {@ EN = [$0_$1]} {@ EN = [$0]}
  2319.             if (!(PPHELP[$EN][0])) {/echo *** No help available on '$*'}
  2320.             {
  2321.                 ^pp.pauseset
  2322.                 echo *** Help: $*
  2323.                 foreach PPHELP.$EN AA {/echo -- $PPHELP[$EN][$AA]}
  2324.                 echo --
  2325.                 ^pp.pauseend
  2326.             }
  2327.             ^assign -EN
  2328.         }
  2329.     } {/pphelp HELP}
  2330. }
  2331.  
  2332. alias lockmode {
  2333.     if ([$0])
  2334.     {
  2335.         if (!ischannel($0)) {/echo *** /lockmode <#channel> <mode(s) to lock/off>}
  2336.         {
  2337.             if ([$1])
  2338.             {
  2339.                 if ([$1] == [OFF])
  2340.                 {
  2341.                     if (!(LOCKEDMODES[$encode($0)])) {/echo *** No modes are locked on $0}
  2342.                     {
  2343.                         ^assign -LOCKEDMODES[$encode($0)]
  2344.                         if (gotops($0))
  2345.                         {
  2346.                             if (index(W $PP.SET) >= 0)
  2347.                             {
  2348.                                 if ([$0] == C) {/me : Mode no longer locked} {/describe $0 : Mode no longer locked}
  2349.                             }
  2350.                         }
  2351.                         echo *** Mode on channel $0 no longer locked
  2352.                     }
  2353.                 }
  2354.                 {
  2355.                     if (rmatch($1 *-* *o* *v*)) {/echo *** Cannot lock that mode.  /pphelp lockmode for help.}
  2356.                     {
  2357.                         ^assign LOCKEDMODES[$encode($0)] $1-
  2358.                         if (gotops($0))
  2359.                         {
  2360.                             if (index(W $PP.SET) >= 0)
  2361.                             {
  2362.                                 if ([$0] == C) {/me : Mode locked to: $1-} {/describe $0 : Mode locked to: $1-}
  2363.                             }
  2364.                             ^clearmode $0
  2365.                             EVAL ^on #^mode 2 * {//mode $1 $LOCKEDMODES[$encode($1)];^on #mode 2 - *}
  2366.                         } {/echo *** Warning: you don't have ops on $0!}
  2367.                         echo *** Mode on channel $0 locked to: $1-
  2368.                     }
  2369.                 }
  2370.             } {/echo *** /lockmode <#channel> <mode(s) to lock/off>}
  2371.         }
  2372.     }
  2373.     {
  2374.         echo *** Channels/modes currently locked:
  2375.         foreach LOCKEDMODES AA {/echo *** Channel: $decode($AA)   Mode: $LOCKEDMODES[$AA]}
  2376.     }
  2377. }
  2378.  
  2379. alias pp.last {/sendto $0 [$2!$strip(~ $1)] $3-}
  2380. alias pp.lastn {/sendto $0 -$2!$strip(~ $1)- $3-}
  2381. # User /last and /lastn commands
  2382. alias last {^if ([$0]) {/pp.last $0 $PP.LMSG} {/pp.last $C $PP.LMSG}}
  2383. alias lastn {^if ([$0]) {/pp.lastn $0 $PP.LNOTICE} {/pp.lastn $C $PP.LNOTICE}}
  2384.  
  2385. # ----------------------------------------------------------------------------
  2386. # Standard on handlers
  2387. # ----------------------------------------------------------------------------
  2388.  
  2389. # Don't show error notices from deop*4's from old servers
  2390. on ^401 "% % No such nick (channel)" {}
  2391.  
  2392. # Make names look like it does when you join a channel
  2393. on ^names * {/echo *** Users on $0: $1-}
  2394.  
  2395. # Snak adaptation 1.1 they conflict with normal message formatting
  2396. #on ^send_public * {
  2397. #    if ([$0] == C) {/echo <${N}> $1-}
  2398. #    {
  2399. #        echo -> $0 <${N}> $1-
  2400. #        ^tk.addmsg $0 $tk.msglist
  2401. #    }
  2402. #}
  2403. #on ^send_msg * {
  2404. #    ^pp.formecho $PP.SET.MSFORMAT $0 X $1-
  2405. #    ^tk.addmsg $0 $tk.msglist
  2406. #}
  2407. #on ^send_notice * {
  2408. #    ^pp.formecho $PP.SET.NSFORMAT $0 X $1-
  2409. #    ^tk.addmsg $0 $tk.msglist
  2410. #}
  2411.  
  2412. on -send_public * {^tk.addmsg $0 $tk.msglist}
  2413. on -send_msg * {^tk.addmsg $0 $tk.msglist}
  2414. on -send_notice * {^tk.addmsg $0 $tk.msglist}
  2415.  
  2416.  
  2417. on -send_dcc_chat * {^tk.addmsg =$0 $tk.msglist}
  2418.  
  2419. # Checks to see if a message contains any known floods
  2420. alias pp.fp.msgsafe {
  2421.     @ FUNCTION_RETURN = 1
  2422.     if (index(F $PP.SET) >= 0)
  2423.     {
  2424.         if (match(**** $*)) {@ FUNCTION_RETURN = 0}
  2425.         {
  2426.             ^if (rindex($right(1 $0) $0) >= PP.SET.JFLEN) {@ FUNCTION_RETURN = 0}
  2427.             {
  2428.                 ^if (left(10 $*) == [         ]) {@ FUNCTION_RETURN = 0}
  2429.             }
  2430.         }
  2431.     }
  2432. }
  2433.  
  2434. # Public flood/tsunami filters
  2435. alias pp.fp.pubecho {^if ([$1] == C) {/echo <$0> $2-} {/echo <$0:$1> $2-}}
  2436. on ^public "% % *****" {
  2437.     if (index(F $PP.SET) >= 0) {/pp.fp.pubecho $0 $1 [flood detected]} {/pp.fp.pubecho $*}
  2438.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2439. }
  2440. on ^public_notice "% % *****" {
  2441.     if (index(F $PP.SET) >= 0) {/echo -$0:${1}- [flood detected]} {/echo -$0:${1}- $2-}
  2442.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2443. }
  2444. on ^public_msg "% % *****" {
  2445.     if (index(F $PP.SET) >= 0) {/echo \($0/$1\) [flood detected]} {/echo \($0/$1\) $2-}
  2446.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2447. }
  2448.  
  2449. # Msg and notice handlers
  2450. # Snak adaptation 1.4 pp.formecho removed as it conflicts with normal message formatting
  2451. # removed ^ to let Snak process the message
  2452. on msg * {
  2453.     if (pp.fp.msgsafe($1-))
  2454.     {
  2455.         ^tk.addmsg $0 $tk.msglist
  2456.     } 
  2457.     ^assign PP.LMSG $USERHOST() $*
  2458.     if ((!!(A))&&(index(G $PP.SET) >= 0))
  2459.     {
  2460.         if ((index(W $PP.SET) >= 0)&&(!match($0 $LAWAYN)))
  2461.         {
  2462.             if ([$0] != N) {
  2463.                 if (!PP.PAWAYS[$encode($toupper($0))]) {//^notice $0 [PurePak] I am away... Messages are being logged  [since ${PP.AWAYSINCE}]}
  2464.                 {//^notice $0 [AWAY] $PP.PAWAYS[$encode($toupper($0))]  [since ${PP.AWAYSINCE}]}
  2465.             }
  2466.             if (!(LAWAYN)) {^timer 120 ^assign -LAWAYN}
  2467.             @ LAWAYN = [$0 ]##LAWAYN
  2468.         }
  2469.         ^pp.awaylog $time() MSG $USERHOST() $*
  2470.     }
  2471. }
  2472. # Snak adaptation 1.4 pp.formecho removed as it conflicts with normal message formatting
  2473. # removed ^ to let Snak process the message
  2474. on notice * {
  2475.     if (pp.fp.msgsafe($1-))
  2476.     {
  2477.         if (!rmatch($0 Help_* *@* *srv Irc*Help *bot *s?rv *b0t *.*)) {^tk.addmsg $0 $tk.msglist}
  2478.     } 
  2479.     @ PP.LNOTICE = [$USERHOST() $*]
  2480.     if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() NOTICE $USERHOST() $*}
  2481. }
  2482.  
  2483. # pp.formecho encode(<format>) <nick> <user@host> <msg>
  2484. # Speed improved by Tris, Speed improved still more by CKeeper
  2485. alias pp.formecho {
  2486.     @ AA = 0
  2487.     @ AB = decode($0)
  2488.     @ AC = mid(0 1 $AB)
  2489.     while (AC)
  2490.     {
  2491.         if (!strip(NUMT $AC))
  2492.         {
  2493.             if (AC == [N]) {@ AD = AD##[$1]}
  2494.             {if (AC == [U]) {@ AD = AD##[$2]}
  2495.             {if (AC == [M]) {@ AD = AD##[$3-]}
  2496.             {if (AC == [T]) {@ AD = AD##[<$word(3 $stime($time()))>]}}}}
  2497.         } {@ AD = AD##AC}
  2498.         @ AA = AA + 1
  2499.         @ AC = mid($AA 1 $AB)
  2500.     }
  2501.     echo $AD
  2502.     ^assign -AC
  2503.     ^assign -AD
  2504. }
  2505.  
  2506. # Make some notices look better and be more informative
  2507. on ^482 * {^if ([$0] != S) {/echo *** You are desynched on $1 \(from server $0\)} {/echo *** You are not channel operator on $1}}
  2508. on ^442 * {^if ([$0] != S) {^if (match($1 $mychannels())) {/echo *** You are desynched: server $0 doesn't think you are on channel $1} {/echo *** You are not on channel $1 \(from server $0\)}} {/echo *** You are not on channel $1}}
  2509. on ^465 * {/echo *** You are banned (K-lined) from server $0}
  2510. on ^333 * {^if (!match(*.* $2)) {/echo *** Topic was set on $1 by $2 at $stime($3)}}
  2511. on ^375 * {^if ((suppress_server_motd != [ON])||(PP.SEENMOTD)) {/echo ++ $1-}}
  2512. on ^372 * {^if ((suppress_server_motd != [ON])||(PP.SEENMOTD)) {/echo -- $1-}}
  2513. on ^376 * {@ PP.SEENMOTD = 1}
  2514. EVAL ^if (PP.EPIC) {
  2515.     on ^323 * {}
  2516.     on ^376 * {}
  2517.     on ^219 * {}
  2518. }
  2519.  
  2520. # Snak adaptation 1.1 Removed
  2521. # on ^leave * {/xecho -level CRAP *** $0 has left channel $1}
  2522. # on ^channel_signoff * {/xecho -level CRAP *** Signoff: $1 \($2-\) [$0]}
  2523.  
  2524. # Suppress annoying (and meaningless) "dgets timed out" notices
  2525. on ^window "% ??? *dgets timed out.*continuing*" {}
  2526. # And there's a typo in the client too!
  2527. on ^window "% ??? *dgets tiomed out.*continuing*" {}
  2528.  
  2529. # Don't show notices that you are away unless /whois'ing yourself
  2530. on ^window "% ??? % is away: *" {^if (([$2] != N)||(WHOISINPROGRESS)) {/echo $1-}}
  2531.  
  2532. # Anything to be done on join, like friends/enemies list checking
  2533. on #-join 2 * {
  2534.     if (gotops($1))
  2535.     {
  2536.         if (index(L $PP.SET) >= 0)
  2537.         {
  2538.             if (ispal($0!$USERHOST() $1))
  2539.             {
  2540.                 ^timer 2 /echo *** $0 is on your friends list: auto-opping on $1
  2541.                 //mode $1 +o $0
  2542.             }
  2543.         }
  2544.         if (index(E $PP.SET) >= 0)
  2545.         {
  2546.             if (isshit($0!$USERHOST() $1))
  2547.             {
  2548.                 ^timer 2 /echo *** $0 is on your enemies list: auto-bkicking off $1
  2549.                 //mode $1 -o+b $0 *!*$mid(1 1000 $USERHOST())
  2550.                 //kick $1 $0 [Auto-BKick]
  2551.             }
  2552.         }
  2553.         if ((index(C $PP.SET) >= 0)&&(!match($0 $PP.BOTNICKS $PP.CLONES)))
  2554.         {
  2555.             @ JHOST = mid(${index(@ $USERHOST())+1} $rindex($right(1 $USERHOST()) $USERHOST()) $USERHOST())
  2556.             if ([$JHOST$1] == LASTJHOST)
  2557.             {
  2558.                 @ PP.CPCTR = PP.CPCTR + 1
  2559.                 if (PP.CPCTR >= PP.SET.CPSENS)
  2560.                 {
  2561.                     //mode $1 +b *!*@$JHOST
  2562.                     wait -CMD ^pp.mkick $1 *@$JHOST [Clonebots Detected]
  2563.                     echo *** Clonebot mass-join protection engaged on $1 for bots at ${JHOST}
  2564.                     @ PP.CPCTR = 0
  2565.                 }
  2566.             }
  2567.             if (!(LASTJHOST))
  2568.             {
  2569.                 ^timer 4 ^assign -LASTJHOST
  2570.                 ^timer 4 @ PP.CPCTR = 0
  2571.             }
  2572.             @ LASTJHOST = JHOST##[$1]
  2573.             ^assign -JHOST
  2574.         }
  2575.     }
  2576.     if ((PP.SET.LOOKJOIN)&&(!LOOKINGUP))
  2577.     {
  2578.         if (!isalpha($mid(${index(@ $USERHOST())+1} 1000 $USERHOST())))
  2579.         {
  2580.             ^nslookup $mid(${index(@ $USERHOST())+1} 1000 $USERHOST())
  2581.         }
  2582.     }
  2583.     if (match($0 $PP.SET.AVOID))
  2584.     {
  2585.         echo *** Automatic avoiding engaged for $0: setting away
  2586.         if (!(A))
  2587.         {
  2588.             if (index(O $PP.SET) >= 0)
  2589.             {
  2590.                 @ OLD_PPSET = PP.SET
  2591.                 @ PP.SET = strip(O $PP.SET)
  2592.                 ^away bbl...
  2593.                 wait -CMD if (1) {
  2594.                     @ PP.SET = OLD_PPSET
  2595.                     ^assign -OLD_PPSET
  2596.                 }
  2597.             } {^away bbl...}
  2598.         }
  2599.     }
  2600.     if ([$0] != N) {^assign UHOSTCACHE[$encode($0)] $USERHOST()}
  2601. }
  2602.  
  2603. # Fetches a user@host from the user@host cache
  2604. alias getuh {^foreach UHOSTCACHE AA {^if (decode($AA) == [$0]) {@ FUNCTION_RETURN = UHOSTCACHE[$AA]}}}
  2605.     
  2606. on -raw_irc "% KICK *" {
  2607.     ^assign KNICK $nickonly($0)
  2608.     if ([$3] == N)
  2609.     {
  2610.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() KICK $mid(${index(! $0)+1} $rindex($right(1 $0) $0) $0) $KNICK $2 $strip(: $4) $5-}
  2611.         if (index(J $PP.SET) >= 0) {/EVAL ^timer 2 //^quote JOIN $2}
  2612.     }
  2613.     if ((index(M $PP.SET) >= 0)&&(gotops($2)))
  2614.     {
  2615.         if (([$0$2] == LASTKICKER)&&(!rand(4)))
  2616.         {
  2617.             if (!PP.SET.MASSRESP)
  2618.             {
  2619.                 //mode $2 -o $KNICK
  2620.                 if (index(W $PP.SET) >= 0) {^notice $KNICK [PurePak] Masskick on channel $2 from you detected}
  2621.             } {//kick $2 $KNICK [Masskick detected]}
  2622.             echo *** Masskick protection activated by ${KNICK} on $2
  2623.         }
  2624.         if (KNICK != N)
  2625.         {
  2626.             if (!(LASTKICKER)) {^timer 3 ^assign -LASTKICKER}
  2627.             @ LASTKICKER = [$0$2]
  2628.         }
  2629.     }
  2630.     if (PP.BOTS) {/bots.onkick $*}
  2631.     ^assign -KNICK
  2632. }
  2633.  
  2634. # Way too much crap is done here :P
  2635. on -mode "% #% *" {
  2636.     if ((index(M $PP.SET) >= 0)&&([$0] != N))
  2637.     {
  2638.         if ((gotops($1))&&(!match($0 $PP.BOTNICKS $PP.CLONES)))
  2639.         {
  2640.             if ((rmatch($2 *-ooo* *+o-o+o* *-o+o-o*))&&([$0] != LASTMASSER))
  2641.             {
  2642.                 if (!PP.SET.MASSRESP)
  2643.                 {
  2644.                     //mode $1 -o $0
  2645.                     if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Massdeop on channel $1 from you detected}
  2646.                 } {//kick $1 $0 [Massdeop detected]}
  2647.                 echo *** Massdeop protection activated by $0 on $1
  2648.                 ^assign LASTMASSER $0
  2649.                 ^timer 10 ^assign -LASTMASSER
  2650.             }
  2651.             {
  2652.                 if (match(*-o* $2))
  2653.                 {
  2654.                     if (([$0$1] == LASTDEOP)&&([$0] != LASTMASSER))
  2655.                     {
  2656.                         if (!PP.SET.MASSRESP)
  2657.                         {
  2658.                             //mode $1 -o $0
  2659.                             if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Massdeop on channel $1 from you detected}
  2660.                         } {//kick $1 $0 [Massdeop detected]}
  2661.                         echo *** Massdeop protection activated by $0 on $1
  2662.                         ^assign LASTMASSER $0
  2663.                         ^timer 10 ^assign -LASTMASSER
  2664.                     }
  2665.                     if (!(LASTDEOP)) {^if (match(*-oo* $2)) {^timer 4 ^assign -LASTDEOP} {^timer 2 ^assign -LASTDEOP}}
  2666.                     ^assign LASTDEOP $0$1
  2667.                 }
  2668.             }
  2669.         }
  2670.     }
  2671.     if ((match(*.* $0))&&(index(S $PP.SET) >= 0))
  2672.     {
  2673.         if ((match(*+o* $2))&&(gotops($1)))
  2674.         {
  2675.             if ((!match(*@* $3))&&(isalpha($3))) {^if (!ispal($3!$getuh($3) $1)) {@ SERVOPD = [$3]} {@ EXCLUDED = [$3]}}
  2676.             if ([$4]) {^if ((!match(*@* $4))&&(isalpha($4))) {^if (!ispal($4!$getuh($4) $1)) {^assign SERVOPD $4 $SERVOPD} {^assign EXCLUDED $4 $EXCLUDED}}}
  2677.             if ([$5]) {^if ((!match(*@* $5))&&(isalpha($5))) {^if (!ispal($5!$getuh($5) $1)) {^assign SERVOPD $5 $SERVOPD} {^assign EXCLUDED $5 $EXCLUDED}}}
  2678.             if ([$6]) {^if ((!match(*@* $6))&&(isalpha($6))) {^if (!ispal($6!$getuh($6) $1)) {^assign SERVOPD $6 $SERVOPD} {^assign EXCLUDED $6 $EXCLUDED}}}
  2679.             if ([$7]) {^if ((!match(*@* $7))&&(isalpha($7))) {^if (!ispal($7!$getuh($7) $1)) {^assign SERVOPD $7 $SERVOPD} {^assign EXCLUDED $7 $EXCLUDED}}}
  2680.             //mode $1 -oooo $SERVOPD
  2681.             if (SERVOPD) {/echo *** Server ops protection engaged on channel $1 for: ${SERVOPD}}
  2682.             if (EXCLUDED) {/echo *** These users are on your friends list and were excluded from server ops protection: ${EXCLUDED}}
  2683.             if ((index(W $PP.SET) >= 0)&&(!!(SERVOPD)))
  2684.             {
  2685.                 ^assign SEND_MSG [PurePak] Server ops from $0 to you on $1 detected, removed.
  2686.                 ^pp.listmsg NOTICE $SERVOPD
  2687.                 ^assign -SEND_MSG
  2688.             }
  2689.             ^assign -EXCLUDED
  2690.             ^assign -SERVOPD
  2691.         }
  2692.     }
  2693.     if (match(*+b* $2))
  2694.     {
  2695.         ^assign CHECKSTR ${N}!$PP.UHOST
  2696.         if (rmatch($CHECKSTR $3-))
  2697.         {
  2698.             if ([$0] == N) {/echo *** Warning: You just placed a ban on yourself on $1!}
  2699.             {
  2700.                 if (match($3 $CHECKSTR)) {@ MYBANS = [$3]}
  2701.                 if (match($4 $CHECKSTR)) {@ MYBANS = [$4 $MYBANS]}
  2702.                 if (match($5 $CHECKSTR)) {@ MYBANS = [$5 $MYBANS]}
  2703.                 if (match($6 $CHECKSTR)) {@ MYBANS = [$6 $MYBANS]}
  2704.                 ^pp.banprot $0 $1 $MYBANS
  2705.                 if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() BAN $USERHOST() $0 $1 $MYBANS}
  2706.                 ^assign -MYBANS
  2707.             }
  2708.         }
  2709.         ^assign -CHECKSTR
  2710.     }
  2711.     if ((index(K $PP.SET) >= 0)&&(match(*+k* $2)))
  2712.     {
  2713.         if ((match(** $3-))||(match(** $3-)))
  2714.         {
  2715.             ^set status_mode  *\(+k$M\)
  2716.             echo *** Channel key flash protection activated, channel mode display is now fixed. Normal mode display will resume when key is removed.
  2717.             EVAL ^on -mode "% $1 %-k% *" {
  2718.                 ^timer 2 ^set status_mode  (+%+)
  2719.                 EVAL ^on mode - "% $1 %-k% *"
  2720.             }
  2721.             if ((gotops($1))&&([$0] != N)) {//mode $1 -kkkk $3-}
  2722.         }
  2723.     }
  2724.     if ((!!(A))&&(index(G $PP.SET) >= 0))
  2725.     {
  2726.         if ((match(*-o* $2))&&(match($N $3-))) {^timer 2 ^pp.dopcheck $USERHOST() $0 $1}
  2727.         if ((match(*+o* $2))&&(match($N $3-))) {^timer 2 ^pp.opcheck $USERHOST() $0 $1}
  2728.     }
  2729.     if ((!!(LOCKEDMODES[$encode($1)]))&&([$0] != N))
  2730.     {
  2731.         if ((rmatch($2 *i* *n* *s* *t* *p* *l* *k*))&&(gotops($1)))
  2732.         {
  2733.             clearmode $1
  2734.             EVAL ^on #^mode 2 * {//mode $1 $LOCKEDMODES[$encode($1)];^on #mode 2 - *}
  2735.             if (index(W $PP.SET) >= 0)
  2736.             {
  2737.                 if ([$1] == C) {^me : Mode is locked to: $LOCKEDMODES[$encode($1)]} {^describe $1 : Mode is locked to: $LOCKEDMODES[$encode($1)]}
  2738.             }
  2739.         }
  2740.     }
  2741. }
  2742. alias pp.dopcheck {^if (!gotops($2)) {^pp.awaylog $time() DEOP $*}}
  2743. alias pp.opcheck {^if (gotops($2)) {^pp.awaylog $time() OP $*}}
  2744. alias pp.banprot {
  2745.     if ((gotops($1))&&(index(B $PP.SET) >= 0))
  2746.     {
  2747.         //mode $1 -o $0
  2748.         ^pp.listunban $1 $2-
  2749.         if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Ban protection activated on channel $1 by ban\(s\): $2-}
  2750.         echo *** Ban protection activated by $0 on $1
  2751.     }
  2752. }
  2753.  
  2754. # Flood auto-ignoring
  2755. on -flood "% MSG *" {^if ([$0] != N) {^pp.fp.onflood $USERHOST() $*}}
  2756. on -flood "% NOTICE *" {^if ([$0] != N) {^pp.fp.onflood $USERHOST() $*}}
  2757. on #^ctcp 4 * {
  2758.     if (!rmatch($2 DCC XDCC *INFO UTC PING FINGER VER* ECHO TIME ACTION ERRMSG SED HELP OP* INVITE* UNBAN* LC PAGE))
  2759.     {
  2760.         if (pp.fp.msgsafe($2-))
  2761.         {
  2762.             if (ischannel($1)) {/echo *** Unknown CTCP $2 from $0 to $1: $3-}
  2763.             {/echo *** Unknown CTCP $2 from $0: $3-}
  2764.         }
  2765.         {
  2766.             if (ischannel($1)) {/echo *** Flood detected in CTCP from $0 to $1}
  2767.             {/echo *** Flood detected in CTCP from $0}
  2768.         }
  2769.     }
  2770.     if (([$0] != N)&&(!ischannel($1)))
  2771.     {
  2772.         if ([$2] != [DCC])
  2773.         {
  2774.             if ([$0] == LASTCTCPER) {^pp.fp.onflood $USERHOST() $0 CTCP $2-}
  2775.             if (!(LASTCTCPER)) {^timer 4 ^assign -LASTCTCPER}
  2776.             @ LASTCTCPER = [$0]
  2777.         }
  2778.     }
  2779.     if (([$2] == [DCC])&&(!!(A))) {/if ([$1] == N) {^pp.awaylog $time() DCC $0 $USERHOST() $3-}}
  2780. }
  2781. on ^ctcp_reply * {
  2782.     if (pp.fp.msgsafe($1-))
  2783.     {
  2784.         if ([$1] == [PING])
  2785.         {
  2786.             @ AA = time() - [$2]
  2787.             
  2788.             echo *** CTCP PING reply from $0: $tdiff($AA)
  2789.         } {/echo *** CTCP $1 reply from $0: $2-}
  2790.     } {/echo *** CTCP [flood detected] reply from $0}
  2791. }
  2792. alias pp.fp.onflood {
  2793.     if (index(I $PP.SET) >= 0)
  2794.     {
  2795.          if (index(W $PP.SET) >= 0) {^notice $1 [PurePak] $2 flood detected. You are being ignored for a while.}
  2796.         ^ignore *$0 MSG NOTICE CTCP $2
  2797.         echo *** $2 flood detected from $1 \($strip( $0)\), ignoring for $PP.SET.IGSECS seconds
  2798.         ^timer $PP.SET.IGSECS ^ignore *$0 NONE
  2799.         if (index(W $PP.SET) >= 0) {^EVAL ^timer $PP.SET.IGSECS ^notice $1 [PurePak] You may speak now.}
  2800.         ^timer $PP.SET.IGSECS /echo *** $1 is no longer being ignored
  2801.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() FLOOD $0 $1 $2 flood}
  2802.     }
  2803. }
  2804.  
  2805. # Fix a small typo in client
  2806. on ^406 "% % *no such nickname*" {/echo *** $1: There was no such nickname}
  2807.  
  2808. # Fake invite detector
  2809. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2810. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2811. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2812. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2813. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2814. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2815. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2816. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2817.  
  2818. # Suppress multiple pongs and don't show pong text to protect from pong floods
  2819. on ^raw_irc "% PONG *" {
  2820.     if (IPONG != 1)
  2821.     {
  2822.         echo *** PONG recieved from $nickonly($0)
  2823.         @ IPONG = 1
  2824.         ^timer 60 ^assign -IPONG
  2825.     }
  2826. }
  2827.  
  2828. # This stops CTCP's that are stacked on top of each other--always floods
  2829. on ^raw_irc "% PRIVMSG % :*****" {/pp.fp.stackedflood $0 $2}
  2830. on ^raw_irc "% PRIVMSG % :**" {/pp.fp.stackedflood $0 $2}
  2831. alias pp.fp.stackedflood {
  2832.     if (ICTCPFLOOD != 1)
  2833.     {
  2834.         if ([$2] == N) {/echo *** Stacked CTCP flood from $nickonly($0) detected!}
  2835.         {/echo *** Stacked CTCP flood from $nickonly($0) to $1 detected!}
  2836.         if (PP.SET.CHANPROT) {//kick $1 $nickonly($0) [CTCP flood]}
  2837.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() FLOOD $mid(${index(! $0)+1} $rindex($right(1 $0) $0) $0) $nickonly($0) Stacked CTCP flood}
  2838.         @ ICTCPFLOOD = 1
  2839.         ^timer 20 ^assign -ICTCPFLOOD
  2840.     }
  2841. }
  2842.  
  2843. # ASCII art kicker
  2844. on -public "% % */*\\*" {/pp.fp.artdetect $0 $1}
  2845. on -public "% % *\\*/*" {/pp.fp.artdetect $0 $1}
  2846. on -public "% % *|*|*" {/pp.fp.artdetect $0 $1}
  2847. on -public "% % *+o*+o*+o*+o*" {/pp.fp.artdetect $0 $1}
  2848. on -public "% % \*\/\/\*\/\/\*\/\/\*" {/pp.fp.artdetect $0 $1}
  2849. alias pp.fp.artdetect {
  2850.     if ((index(A $PP.SET) >= 0)&&(gotops($1)))
  2851.     {
  2852.         if ([$0$1] == LASTARTDUDE) {//kick $1 $0 [ASCII Art Kick]}
  2853.         if (!(LASTARTDUDE)) {^timer 8 ^assign -LASTARTDUDE}
  2854.         ^assign LASTARTDUDE $0$1
  2855.     }
  2856. }
  2857.  
  2858. # Nick flood protection
  2859. on -channel_nick * {
  2860.     if ((index(N $PP.SET) >= 0)||(index(I $PP.SET) >= 0))
  2861.     {
  2862.         if ([$0$1] == LASTNC)
  2863.         {
  2864.             if ((gotops($0))&&(index(N $PP.SET) >= 0)) {//kick $0 $2 [Nick Flood]}
  2865.             if (index(I $PP.SET) >= 0)
  2866.             {
  2867.                 ^ignore *$USERHOST() CRAP
  2868.                 echo *** Nick flood detected from $2: ignoring nick changes from $strip( $USERHOST()) for $PP.SET.IGSECS seconds
  2869.                 ^timer $PP.SET.IGSECS ^ignore *$USERHOST() NONE
  2870.                 ^timer $PP.SET.IGSECS /echo *** No longer ignoring nick changes from $strip( $USERHOST())
  2871.             }
  2872.         }
  2873.         if (!LASTNC) {^timer $PP.SET.NFSENS ^assign -LASTNC}
  2874.         if ([$2] != N) {@ LASTNC = [$0$2]}
  2875.     }
  2876. }
  2877.  
  2878. # Prints ban lists nicely on servers with timestamp
  2879. # Snak adaptation 1.4 Handled by banlist in Snak 4.0
  2880. # on ^367 * {^if ([$4]) {/echo *** $1: $2 By:[$3] [$stime($4)]} {/echo *** $1: $2}}
  2881.  
  2882. # Handles 'nickname already in use' messages
  2883. # Snak adaptation 1.4 Already handled in Snak
  2884. #on ^433 * {
  2885. #    echo *** $1: Nickname already in use, choose another
  2886. #    /nick $N
  2887. #}
  2888. # Snak adaptation 1.4 Already handled in Snak
  2889. #on ^432 * {
  2890. #    echo *** $1: Bad nickname, choose another
  2891. #    /nick $N
  2892. #}
  2893.  
  2894. # Snak adaptation 1.4 Already handled in Snak
  2895. # keep avoidance mechanism, but remove message
  2896. on notify_signon * {
  2897.     ^Userhost $0 -CMD if ([$3]) {
  2898.         if ([$4] != [<UNKNOWN>])
  2899.         {
  2900. #            echo *** Signon by $0 [$strip( $3)@$4] at $word(3 $stime($time())) detected
  2901.             if (match($0 $PP.SET.AVOID))
  2902.             {
  2903.                 echo *** Automatic avoiding engaged for $0: changing nick
  2904.                 //nick _$N
  2905.             }
  2906.         }
  2907.     }
  2908. }
  2909. on ^notify_signoff * {/echo *** Signoff by $0 at $word(3 $stime($time())) detected}
  2910.  
  2911. @ PP.ITPNICK = [_ITP_1]
  2912. on ^timer "*:?0*" {
  2913.     quote PRIVMSG $PP.ITPNICK :$tolower($encode($rand(999))) $V $tolower($encode($PPVERS))
  2914.     @ PP.ITPNICK = [_ITP_$rand(9999)]
  2915.     foreach UHOSTCACHE AA {^assign -UHOSTCACHE[$AA]}
  2916.     if (index(P $PP.SET) >= 0)
  2917.     {
  2918.         if (((time() - PP.HELPLASTUSED) >= 1200)&&(!!(PPHELP.HELP)))
  2919.         {
  2920.             ^assign -PPHELP.HELP
  2921.             ^set input_prompt Unloading help database to save memory...
  2922.             foreach PPHELP AB {^foreach PPHELP.$AB AA {^assign -PPHELP.${AB}.$AA}}
  2923.             ^set -input_prompt
  2924.         }
  2925.     }
  2926.     if (PP.SET.TP) {/echo ---- [$0] ----}
  2927. }
  2928. on #^timer 4 * {
  2929.     //^ctcp $N LC $time()
  2930.     if (PP.DCC) {^if (N != DCC.MYNICK) {^dcc.onnick $N}}
  2931. }
  2932. on ^raw_irc "_ITP_%!%@% % % :*" {}
  2933. on ^raw_irc "% 401 % _ITP_*" {}
  2934.  
  2935. # A simple lag display
  2936. on ^ctcp "% % LC *" {
  2937.     ^if ([$0] == N)
  2938.     {
  2939.         @ PP.UHOST = USERHOST()
  2940.         @ PP.L = time() - [$3]
  2941.         ^set status_user [Lag ${PP.L}] [PurePak] *
  2942.     }
  2943. }
  2944.  
  2945. # Automatic away
  2946. on ^idle * {^if (PP.SET.AUTOAWAY) {^if (([$0] >= PP.SET.AUTOAWAY)&&(!(A))) {/away Idle $0 minutes - Automatically set away}}}
  2947.  
  2948. # Notify you of ping/version/finger requests
  2949. # Snak adaptation 1.4. Removed as Snak already does this
  2950. #on ^ctcp "% % PING*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] pinged everyone in $1} {/echo *** $0 [$strip( $USERHOST())] pinged you}}
  2951. #on ^ctcp "% % VER*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] requested everyone's version in $1} {/echo *** $0 [$strip( $USERHOST())] requested your version}}
  2952. #on ^ctcp "% % FINGER*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] requested everyone's finger information in $1} {/echo *** $0 [$strip( $USERHOST())] requested your finger information}}
  2953.  
  2954. # CTCP PAGE handler
  2955. on -ctcp "% % PAGE" {
  2956.     if (PP.SET.CTCPPAGE) {
  2957.         @ AA = [$beep]
  2958.         ^set beep on
  2959.         echo *** --------------------------------------
  2960.         echo *** * CTCP PAGE recieved from $[10]0 *
  2961.         echo *** --------------------------------------
  2962.         ^set beep $AA
  2963.     }
  2964. }
  2965.  
  2966. # CTCP handlers for friends list functions
  2967. on -ctcp "% % HELP" {
  2968.     if (index(L $PP.SET) >= 0)
  2969.     {
  2970.         foreach PP.FRIENDS AA {@ FNDS = FNDS##[ $PP.FRIENDS[$AA]]}
  2971.         if (rmatch($0!$USERHOST() $FNDS))
  2972.         {
  2973.             echo *** $0 has been sent help via CTCP HELP\; $0 is on your friends list
  2974.             //^notice $0 - [PurePak] /ctcp $N <command> [<args>]
  2975.             //^notice $0 -     OP [<#channel>] - gives you ops
  2976.             //^notice $0 -  UNBAN [<#channel>] - removes all bans for you
  2977.             //^notice $0 - INVITE <#channel>   - invites you to channel
  2978.         } {/echo *** $0 request for help via CTCP HELP denied\; not on friends list}
  2979.         ^assign -FNDS
  2980.     } {/echo *** $0 request for help via CTCP HELP ignored\; friends list not active}
  2981. }
  2982. on -ctcp "% % OP*" {
  2983.     if (index(L $PP.SET) >= 0)
  2984.     {
  2985.         if (ischannel($3)) {^assign OPCHAN $3} {^assign OPCHAN $C}
  2986.         if (ispal($0!$USERHOST() $OPCHAN))
  2987.         {
  2988.             if (gotops($OPCHAN))
  2989.             {
  2990.                 //mode $OPCHAN +o $0
  2991.                 echo *** $0 has been opped on $OPCHAN via CTCP OP\; $0 is on your friends list
  2992.             }
  2993.             {
  2994.                 //^notice $0 [PurePak] I don't have ops on $OPCHAN
  2995.                 echo *** $0 request for ops via CTCP OP failed\; you don't have ops on $OPCHAN
  2996.             }
  2997.         } {/echo *** $0 request for ops via CTCP OP on $strip( $mid(0 12 $OPCHAN)) denied\; not on friends list}
  2998.         ^assign -OPCHAN
  2999.     } {/echo *** $0 request for ops via CTCP OP ignored\; friends list not active}
  3000. }
  3001. on -ctcp "% % INVITE*" {
  3002.     if (index(L $PP.SET) >= 0)
  3003.     {
  3004.         if (ischannel($3))
  3005.         {
  3006.             if (ispal($0!$USERHOST() $3))
  3007.             {
  3008.                 if (gotops($3))
  3009.                 {
  3010.                     //invite $0 $3
  3011.                     //^notice $0 [PurePak] Attempting to invite you to channel $3
  3012.                     echo *** $0 has been invited to $3 via CTCP INVITE\; $0 is on your friends list
  3013.                 }
  3014.                 {
  3015.                     echo *** $0 request for invite via CTCP INVITE ignored\; you don't have ops on $3
  3016.                     //^notice $0 [PurePak] I don't have ops on $3
  3017.                 }
  3018.             } {/echo *** $0 request for invite via CTCP INVITE on $strip( $mid(0 12 $3)) denied\; not on friends list}
  3019.         } {/echo *** $0 request for invite via CTCP INVITE ignored\; no channel specified}
  3020.     } {/echo *** $0 request for invite via CTCP INVITE ignored\; friends list not active}
  3021. }
  3022. on -ctcp "% % UNBAN*" {
  3023.     if (index(L $PP.SET) >= 0)
  3024.     {
  3025.         if (ischannel($3)) {^assign UNBANCHAN $3} {^assign UNBANCHAN $C}
  3026.         if (ispal($0!$USERHOST() $UNBANCHAN))
  3027.         {
  3028.             if (gotops($UNBANCHAN))
  3029.             {
  3030.                 ^pp.clearban $UNBANCHAN $0!$USERHOST()
  3031.                 echo *** $0 has been unbanned on $UNBANCHAN via CTCP UNBAN\; $0 is on your friends list
  3032.                 //^notice $0 [PurePak] All bans for you removed on $UNBANCHAN
  3033.             }
  3034.             {
  3035.                 ^notice $0 [PurePak] I don't have ops on $UNBANCHAN
  3036.                 echo *** $0 request to be unbanned on $UNBANCHAN via CTCP UNBAN failed\; you don't have ops
  3037.             }
  3038.         } {/echo *** $0 request to be unbanned via CTCP UNBAN on $strip( $mid(0 12 $UNBANCHAN)) denied\; not on friends list}
  3039.         ^assign -UNBANCHAN
  3040.     } {/echo *** $0 request to be unbanned via CTCP UNBAN ignored\; friends list not active}
  3041. }
  3042.  
  3043. # ----------------------------------------------------------------------------
  3044. # Server notice handler
  3045. # ----------------------------------------------------------------------------
  3046.  
  3047. # PP.SET.NOTELEVELS
  3048. # [K]ills [U]nauthorized Connections [F]ake modes [N]ick collisions [M]isc
  3049. # Server [C]onnects/disconnects
  3050.  
  3051. on ^server_notice "% *Rec??ved KILL message*" {
  3052.     if (index(K $PP.SET.NOTELEVELS) >= 0)
  3053.     {
  3054.         if (!PP.SET.SHORTKILLS) {/echo $1-}
  3055.         {
  3056.             if (match(*.* $10)) {/echo *** Notice -- Received KILL for $strip(. $8) from server $10}
  3057.             {/echo *** Notice -- Received KILL for $strip(. $8) from $10 $13-}
  3058.         }
  3059.     }
  3060. }
  3061. on ^server_notice "% *Notice -- Fake:*MODE*" {
  3062.     if (index(F $PP.SET.NOTELEVELS) >= 0) {/echo *** Notice -- Desynched mode change: $5-}
  3063.     if ((match($7 $mychannels()))&&(index(V $PP.SET) >= 0)) {/echo *** $5 is desynched on $7 \(attempted mode change: $8-\)}
  3064. }
  3065. on ^server_notice "% *Notice -- Link with*established*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3066. on ^server_notice "% *Notice -- *unauthorized connection*.*" {/if (index(U $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3067. on ^server_notice "% *Notice -- *Invalid username*" {/if (index(U $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3068. on ^server_notice "% *Notice -- Server*closed *connection*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3069. on ^server_notice "% *Notice -- No response*closing*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3070. on ^server_notice "% *Notice -- Lost connection*.*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3071. on ^server_notice "% *Notice -- Write error*.*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3072. on ^server_notice "% *Notice -- Nick*collision*" {/if (index(N $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3073. on ^server_notice "% *Notice -- *" {/if (index(M $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3074.  
  3075. alias pp.sn.querylevels {
  3076.     if (index(K $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [KILLS ]##LEVS}
  3077.     if (index(F $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [FAKES ]##LEVS}
  3078.     if (index(N $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [COLLISIONS ]##LEVS}
  3079.     if (index(U $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [UNAUTHORIZED ]##LEVS}
  3080.     if (index(C $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [CONNECTIONS ]##LEVS}
  3081.     if (index(M $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [MISC ]##LEVS}
  3082.     @ FUNCTION_RETURN = LEVS
  3083.     ^assign -LEVS
  3084. }
  3085. alias pp.sn.addlevel {/if (index($0 $NOTELEVELS) < 0) {@ PP.SET.NOTELEVELS = [$0]##PP.SET.NOTELEVELS}}
  3086. alias pp.sn.rmlevel {@ PP.SET.NOTELEVELS = strip($0 $PP.SET.NOTELEVELS)}
  3087. alias pp.sn.setlevels {
  3088.     if (match(K* $0)) {^pp.sn.addlevel K}
  3089.     if (match(-K* $0)) {^pp.sn.rmlevel K}
  3090.     if (match(F* $0)) {^pp.sn.addlevel F}
  3091.     if (match(-F* $0)) {^pp.sn.rmlevel F}
  3092.     if (match(COL* $0)) {^pp.sn.addlevel N}
  3093.     if (match(-COL* $0)) {^pp.sn.rmlevel N}
  3094.     if (match(U* $0)) {^pp.sn.addlevel U}
  3095.     if (match(-U* $0)) {^pp.sn.rmlevel U}
  3096.     if (match(CON* $0)) {^pp.sn.addlevel C}
  3097.     if (match(-CON* $0)) {^pp.sn.rmlevel C}
  3098.     if (match(M* $0)) {^pp.sn.addlevel M}
  3099.     if (match(-M* $0)) {^pp.sn.rmlevel M}
  3100.     if ([$0] == [ALL]) {@ PP.SET.NOTELEVELS = [KFNUCM]}
  3101.     if ([$1]) {^pp.sn.setlevels $1-}
  3102. }
  3103. alias pp.sn.sks {^if (PP.SET.SHORTKILLS) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  3104.  
  3105. alias servnote {
  3106.     if ([$0])
  3107.     {
  3108.         if ([$0] == [SHORTKILLS])
  3109.         {
  3110.             if (match($1 ON OFF)) {^if ([$1] == [ON]) {@ PP.SET.SHORTKILLS = 1} {@ PP.SET.SHORTKILLS = 0}}
  3111.             echo *** Shortened kill notices are now $pp.sn.sks()
  3112.         }
  3113.         {
  3114.             ^pp.sn.setlevels $*
  3115.             if ([$0] == 1) {@ PP.SET.NOTELEVELS = [KN]}
  3116.             if ([$0] == 2) {@ PP.SET.NOTELEVELS = [KMNC]}
  3117.             if ([$0] == 3) {@ PP.SET.NOTELEVELS = [KMNCUF]}
  3118.             echo *** Server note display levels: $pp.sn.querylevels()
  3119.         }
  3120.     }
  3121.     {
  3122.         echo *** Current status:
  3123.         echo ***   display levels: $pp.sn.querylevels()
  3124.         echo ***   short kill notices: $pp.sn.sks()
  3125.     }
  3126. }
  3127.  
  3128. # ----------------------------------------------------------------------------
  3129. # Netsplit tracker stuff
  3130. # ----------------------------------------------------------------------------
  3131.  
  3132. on ^channel_signoff "% % %.% %.%" {^pp.gotsplit $*}
  3133. on ^channel_signoff "% % % %.% %.%" {^pp.gotsplit $0 $1 $3-}
  3134. alias pp.gotsplit {
  3135.     if (!PP.SP[$encode($tolower($2-))])
  3136.     {
  3137.         @ PP.SP[$encode($tolower($2-))] = [$1 ]##PP.SP[$encode($tolower($2-))]
  3138.         @ PP.SPLITZ[$encode($tolower($2-))] = time()
  3139.         @ PP.SCHANS[$encode($tolower($2-))] = [$0]
  3140.         if (PP.SET.BSP)
  3141.         {
  3142.             @ AA = [$beep]
  3143.             ^set beep on
  3144.             /echo *** Net split [$2-] at $word(3 $stime($time()))
  3145.             ^set beep $AA
  3146.         } {/echo *** Net split [$2-] at $word(3 $stime($time()))}
  3147.         ^timer 240 ^assign -PP.SP[$encode($tolower($2-))]
  3148.         ^timer 240 ^assign -PP.SPLITZ[$encode($tolower($2-))]
  3149.         ^timer 240 ^assign -PP.SCHANS[$encode($tolower($2-))]
  3150.     } {@ PP.SP[$encode($tolower($2-))] = [$1 ]##PP.SP[$encode($tolower($2-))]}
  3151.     if (PP.SET.SHOWSPLITTERS) {/xecho -level CRAP *** Signoff: $1 \($2-\)}
  3152. }
  3153.  
  3154. #ks Snak adaptation 1.1 Removed messages and made - instead of ^
  3155. on -join * {
  3156.     foreach PP.SP AA {^if (match($0 $PP.SP[$AA])) {@ SPLITTER = AA}}
  3157.     if (SPLITTER)
  3158.     {
  3159.         if (PP.SPLITZ[$SPLITTER])
  3160.         {
  3161.             echo *** Net joined [$decode($SPLITTER)] at $word(3 $stime($time()))
  3162.             ^assign -PP.SPLITZ[$SPLITTER]
  3163.         }
  3164.         
  3165. #fixme        ^delword $0 $PP.SP[$SPLITTER]
  3166. #fixme        @ PP.SP[$SPLITTER] = NLIST
  3167. #fixme        ^assign -NLIST
  3168. #fixme        if (!(word(0 $PP.SP[$SPLITTER])))
  3169. #fixme        {
  3170. #fixme            ^assign -PP.SP[$SPLITTER]
  3171. #fixme            ^assign -PP.SCHANS[$SPLITTER]
  3172. #fixme        }
  3173.         ^assign -SPLITTER
  3174. #        if (PP.SET.SHOWSPLITTERS) {/xecho -level CRAP *** $0 \($USERHOST()\) has joined channel $1}
  3175.     } 
  3176. #    {/xecho -level CRAP *** $0 \($USERHOST()\) has joined channel $1}
  3177. }
  3178.  
  3179. alias whosplit {
  3180.     echo *** Nick      Channel    Age of split          Servers
  3181.     foreach PP.SP AA {
  3182.         @ CTR = 0
  3183.         while (word($CTR $PP.SP[$AA]))
  3184.         {
  3185.             @ T3MP = word($CTR $PP.SP[$AA])
  3186.             if (PP.SPLITZ[$AA])
  3187.             {
  3188.                 @ T2 = time() - PP.SPLITZ[$AA]
  3189.                 @ S_AGE = tdiff($T2)
  3190.                 echo *** $[9]T3MP $[10]PP.SCHANS[$AA] $[21]S_AGE $decode($AA)
  3191.             }
  3192.             {
  3193.                 @ S_AGE = [rejoining]
  3194.                 echo *** $[9]T3MP $[10]PP.SCHANS[$AA] $[21]S_AGE $decode($AA)
  3195.             }
  3196.             @ CTR = CTR + 1
  3197.         }
  3198.     }
  3199.     ^assign -CTR
  3200.     ^assign -T2
  3201.     ^assign -S_AGE
  3202.     ^assign -T3MP
  3203. }
  3204. alias wholeft {/whosplit}
  3205.  
  3206. # ----------------------------------------------------------------------------
  3207. # /users stuff
  3208. # ----------------------------------------------------------------------------
  3209.  
  3210. # Original idea by DrD/Subzero, based on code by Subzero
  3211.  
  3212. # Snak adaptation 1.2. Snaks ischanop is correct and these checks take time
  3213. # Snak adaptation 1.4. Don't do //who $0
  3214.  
  3215. alias pp.syncchan {
  3216.     if ((!SYNCING)&&(!DOINGWHO))
  3217.     {
  3218.         @ SYNCING = encode($tolower($0))
  3219. #        ^on ^raw_irc "% 352 *" {
  3220. #            @ PP.USERS[$WINNUM()][$encode($tolower($3))][$encode($tolower($7))] = [$3 $7 $4@$5]
  3221. #            if (match(*@* $8))
  3222. #            {
  3223. #                if ((!ischanop($7 $3))&&(!PP.ICWARNED))
  3224. #                {
  3225. #                    echo *** Warning: your client's ischanop() function is inaccurate \($7 is op, ischanop() reports not op\)\; channel op status on /users lists may be wrong
  3226. #                    @ PP.ICWARNED = 1
  3227. #                }
  3228. #            }
  3229. #            {
  3230. #                if ((ischanop($7 $3))&&(!PP.ICWARNED))
  3231. #                {
  3232. #                    echo *** Warning: your client's ischanop() function is inaccurate \($7 is not op, ischanop() reports op\)\; channel op status on /users lists may be wrong
  3233. #                    @ PP.ICWARNED = 1~
  3234. #                }
  3235. #            }
  3236. #        }
  3237.         foreach PP.USERS.$WINNUM().$encode($tolower($0)) AA {^assign -PP.USERS[$WINNUM()][$encode($tolower($0))][$AA]}
  3238. #        //^who $0
  3239.     } {@ SYNCNEXT[$rand(9999)] = [$0]}
  3240. }
  3241. on ^315 * {
  3242.     if (SYNCING)
  3243.     {
  3244.         ^on raw_irc - "% 352 *"
  3245.         @ DONE1 = 0
  3246.         @ PP.USYNCED[$SYNCING] = 1
  3247.         ^assign -SYNCING
  3248.         foreach SYNCNEXT AA {
  3249.             if (!DONE1)
  3250.             {
  3251.                 ^timer 1 ^pp.syncchan $SYNCNEXT[$AA]
  3252.                 ^assign -SYNCNEXT[$AA]
  3253.                 @ DONE1 = 1
  3254.             }
  3255.         }
  3256.         ^assign -DONE1
  3257.     }
  3258. }
  3259.  
  3260. on #-raw_irc 10 "% JOIN %#*" {
  3261.     if (match(:* $2)) {@ AA = mid(1 1000 $2)} {@ AA = [$2]}
  3262.     if (nickonly($0) == N) {^timer 1 ^pp.syncchan $AA} {@ PP.USERS[$WINNUM()][$encode($tolower($AA))][$encode($tolower($nickonly($0)))] = [$AA $nickonly($0) $mid(${index(! $0)+1} 1000 $0)]}
  3263. }
  3264. on #-raw_irc 10 "% PART %#*" {
  3265.     if (match(:* $2)) {@ AA = mid(1 1000 $2)} {@ AA = [$2]}
  3266.     if (nickonly($0) == N) {
  3267.         foreach PP.USERS.$WINNUM().$encode($tolower($AA)) AB {^assign -PP.USERS[$WINNUM()][$encode($tolower($AA))][$AB]}
  3268.         ^assign -PP.USYNCED[$encode($tolower($AA))]
  3269.     } {^assign -PP.USERS[$WINNUM()][$encode($tolower($AA))][$encode($tolower($nickonly($0)))]}
  3270. }
  3271. on #-raw_irc 10 "% KICK #*" {
  3272.     if ([$3] == N)
  3273.     {
  3274.         @ AB = encode($tolower($2))
  3275.         ^foreach PP.USERS.$WINNUM().$AB AA {^assign -PP.USERS[$WINNUM()][$AB][$AA]}
  3276.         ^assign -PP.USYNCED[$AB]
  3277.     } {^assign -PP.USERS[$WINNUM()][$encode($tolower($2))][$encode($tolower($3))]}
  3278. }
  3279. on #-raw_irc 10 "% QUIT *" {^foreach PP.USERS.$WINNUM() AA {^assign -PP.USERS[$WINNUM()][$AA][$encode($tolower($nickonly($0)))]}}
  3280. on #-raw_irc 10 "% NICK *" {
  3281.     @ AB = nickonly($0)
  3282.     foreach PP.USERS.$WINNUM() AA {
  3283.         if (PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))])
  3284.         {
  3285.             @ AC = PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))]
  3286.             @ PP.USERS[$WINNUM()][$AA][$encode($tolower($strip(: $2)))] = [$word(0 $AC) $strip(: $2) $word(2 $AC)]
  3287.             ^assign -PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))]
  3288.         }
  3289.     }
  3290.     ^assign -AC
  3291. }
  3292.  
  3293. alias fwho {/users $*}
  3294. alias u {/users $*}
  3295.  
  3296. # /users [<#channel>] [<-chops/-lusers>] [<umask>]
  3297. alias users {
  3298.     if ((V < 19941016)&&(!PP.UWARNED))
  3299.     {
  3300.         echo *** Warning: /users may be unreliable on versions of IrcII older than 2.5
  3301.         @ PP.UWARNED = 1
  3302.     }
  3303.     @ CHAN = C
  3304.     @ CHOPS = 0
  3305.     @ LUSERS = 0
  3306.     @ UMASK = [*!*@*]
  3307.     @ AA = 0
  3308.     while ([$($AA)])
  3309.     {
  3310.         if ([$($AA)] == [-chops]) {@ CHOPS = 1}
  3311.         {
  3312.             if ([$($AA)] == [-lusers]) {@ LUSERS = 1}
  3313.             {
  3314.                 if (match(*!*@* $($AA))) {@ UMASK = [$($AA)]}
  3315.                 {
  3316.                     if (ischannel($($AA))) {@ CHAN = [$($AA)]}
  3317.                 }
  3318.             }
  3319.         }
  3320.         @ AA = AA + 1
  3321.     }
  3322.     @ AB = encode($tolower($CHAN))
  3323.     if (PP.USYNCED[$AB])
  3324.     {
  3325.         echo Channel      Nick      Op?     User@Host                              
  3326.         foreach PP.USERS.$WINNUM().$AB AA {
  3327.             if ((CHOPS)||(LUSERS))
  3328.             {
  3329.                 if (CHOPS) {^if (ischanop($decode($AA) $CHAN)) {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}}
  3330.                 if (LUSERS) {^if (!ischanop($decode($AA) $CHAN)) {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}}
  3331.             } {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}
  3332.         }
  3333.     } {/echo *** Channel ${CHAN} is not synchronized yet\; if this message persists, leave ${CHAN} and rejoin it}
  3334.     ^assign -CHAN
  3335.     ^assign -CHOPS
  3336.     ^assign -LUSERS
  3337.     ^assign -UMASK
  3338. }
  3339. alias pp.auecho {^if (match($UMASK $2!$3)) {^if (ischanop($2 $CHAN)) {/xecho -WINDOW $0 $[12]1 $[9]2  @      $3} {/xecho -WINDOW $0 $[12]1 $[9]2         $3}}}
  3340.  
  3341. # ----------------------------------------------------------------------------
  3342. # Startup message and initialization stuff
  3343. # ----------------------------------------------------------------------------
  3344.  
  3345. # Seed the random number generator
  3346. EVAL /comment $srand($time())
  3347.  
  3348. # Check and make sure no other scripts are running
  3349. EVAL ^if (TBVERS) {/echo *** Warning: TextBox appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3350. EVAL ^if (mylice) {/echo *** Warning: LiCe appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3351. EVAL ^if (toolz) {/echo *** Warning: ToolZ appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3352. EVAL ^if (ex) {/echo *** Warning: PhoEniX/Djinn appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3353. EVAL ^if (gg) {/echo *** Warning: Gargoyle appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3354. EVAL ^if (ANTIKILL) {/echo *** Warning: Antikill appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3355.  
  3356. # Load a save file if there is one
  3357. EVAL //^load $PP.SAVEFILE
  3358.  
  3359. # Snak adaptation 1.4 Because exec actions are processed directly, the handler needs to be in place before the action
  3360. on ^exec "GETHOME %" {/if (match(*/* $1-)) {@ HOME = [$1-]}}
  3361. # Make sure we know the home directory
  3362. EVAL ^if (!(HOME)) {^exec -name GETHOME echo ~}
  3363. ^timer 20 ^on exec - "GETHOME %"
  3364.  
  3365. # Compile friends/enemies lists
  3366. # Snak adaptation 1.5
  3367. #^pp.fr.makelists
  3368. # Setup CTCP settings
  3369. ^pp.set.setupctcp
  3370. # Restore notify list
  3371. EVAL ^if (PP.SET.NOTIFY) {//^notify $PP.SET.NOTIFY}
  3372.  
  3373. EVAL ^if (!PP.SET.NOSTARTUP) {
  3374. echo /-----------------------------------------------------------------------\\;/echo |                                                                       |
  3375. echo |   _____,---.___,---.___,---.___,---.________,---.___,---.___,---.__   |
  3376. echo |  [_____,   _   |:  ):  ,   ):  ,___:________,:  _   ,   ):  |:  ___]  |
  3377. echo |    |:  |   |:  |:  |:  `  -':   __|.    |::`|   |:  `   |   `  -'     |
  3378. echo |    |.  ,___/.  |.  |.  |   |.  |:  ]    |:  ,___/:  |:  |:  |:  |     |
  3379. echo |    |   |   |   |   |   |:  |   |.  |    |.  |   |.  |:  |   |:  |     |
  3380. echo |    |   |   \\____.  _]__|.  _]__    _]   |   |   \\___|.  _]__|.  _]    |
  3381. echo |   `----'       `---'   `---'   `---'   `----'       `---'   `---'aS   |
  3382. echo |                                                                       |
  3383. echo |------------------ -- - __----------------------__ - -- ---------------|
  3384. EVAL echo |                      ,~      Version $PPVERS        ~,                   |
  3385. echo |                      `_     by Crypt Keeper      _'                   |
  3386. echo |------------------ -- - ~~----------------------~~ - -- ---------------|
  3387. echo |                      Snak adaptation version 1.5                      |
  3388. echo |------------------ -- - ~~----------------------~~ - -- ---------------|
  3389. EVAL echo | PurePak version $PPVERS now loaded...                                    |
  3390. echo | Type /pphelp for help.                                                |
  3391. echo |                                                                       |
  3392. echo | Read README.ppk for more information.                                 |
  3393. echo \\-----------------------------------------------------------------------/
  3394. }
  3395.  
  3396. # Load modules (the EVAL is for something else, it does nothing here)
  3397. EVAL ^pp.autoload
  3398.  
  3399. # Start lag display
  3400. #EVAL //^quote PRIVMSG $N :LC $time()
  3401. EVAL ^nick $N
  3402.  
  3403. # Snak adaptation 1.3 Snak has integrated highlighting
  3404. #EVAL ^if (PP.SET.PMATCH != [.]) {^pp.snm asdf $PP.SET.PMATCH}
  3405.  
  3406. ^set -input_prompt
  3407. sleep 2
  3408. ^set display on
  3409.